Click here to Skip to main content
16,004,761 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends.

I have heard that c++ is a very powerful language but I have a big confusion while working in C++.
Till Now, I have gone through so many notes, lectures and books of c++ and I have practically about 1 Year experience of working in c++. In all these sources, we are taught how to use loops, arrays, pointers, classes, functions, methods and other c++ concepts. But I have not found any of the books which provide the guidance towards building a complete project / software in c++. I can make a payroll, and other calculations in c++ but I do not know yet that how to make a hardware level program in c++. From Hardware level program, I mean that How to make a FORMAT program that formats a partition or drive, How to make a hard disk scanning program or How to make a chatting program or How to make a Word Processing software in C++. These are just some examples and I do not want to limit my question to only these software examples. I think you have understood my problem.
So, Is it possible to make such kinds of software in c++, If possible then how can we make them.
Is there any book or guidance available for such kind of programming in c++, having complete practical projects in c++.

So, Please explain some one that what is C++ keeping in view, my above mentioned context.

Note: I am not talking about Visual C++ or C#. But I am talking about C and C++ only.

[edit author='rjm']removed 'shouty' attributes.[/edit]
Posted
Updated 3-Aug-10 1:16am
v3

You can use C library in C++ to do that , remember C libraries are not separated from C++ yet :)

http://simplestcodings.blogspot.com/[^]
 
Share this answer
 
Thanks to All for giving such useful answers.
After Reading Your Answers A good part of my confusion has finished but an Import part of my confusion is yet left. Which is that

When there was no GUI (Graphical User Interface) concept and there was only a Command Line Interface (with a black screen) then with which Language it becomes possible to build the GUI and great operating systems such like Windows.
The Simply meaning of my question is that How the Convert the Black Screen into a Graphical Screen.

I have heard that mostly part of Windows was built in c, Then How they build it with what kind of coding or header files.

While We Know that Windows runs on most of PC Plate forms. Then How it became possible.

Suppose I want to make an Operating System then What Language will be best for me, and Is there any kind of guidance related to Operating System Development.

In Last, Does C have the power to build a Complete OS.
 
Share this answer
 
Thanks to All for giving such useful answers.
After Reading Your Answers A good part of my confusion has finished but an Import part of my confusion is yet left. Which is that

When there was no GUI (Graphical User Interface) concept and there was only a Command Line Interface (with a black screen) then with which Language it becomes possible to build the GUI and great operating systems such like Windows.
The Simply meaning of my question is that How the Convert the Black Screen into a Graphical Screen.

I have heard that mostly part of Windows was built in c, Then How they build it with what kind of coding or header files.

While We Know that Windows runs on most of PC Plate forms. Then How it became possible.

Suppose I want to make an Operating System then What Language will be best for me, and Is there any kind of guidance related to Operating System Development.

In Last, Does C have the power to build a Complete OS.
 
Share this answer
 
Comments
E.F. Nijboer 3-Aug-10 10:21am    
Normally it ain't a good idea to ask follow-up questions as an answer to your own question ;-)

But I read your response and questions now and c can be used to write an OS and of course assembly is great for that. I can try some explaining but the OSDev site is the best way to get started and get all the answers anout this. Have look and start drewling with all that info :-D
http://wiki.osdev.org/Main_Page
Aescleal 3-Aug-10 11:44am    
You can build almost build a complete OS in C or C++. In the past I've written a DOS clone in C which out of about 25,000 lines of source only 400 or so were written in assmebler. Writing a more complex OS would take more but if it was more than 5% of the source code I'd be surprised - optimisation excluded.

If you want to build a windowing environment then C++ would be an excellent choice. You'd have to either rely on someone else's library to handle the vagaries of graphics cards and I/O devices but that isn't too hard when you've come up with a model of how you're going to handle it. So if you're using something crufy like DOS as your OS you can either use the PC BIOS to provide graphics primitives (although it's going to look a bit rubbish) or write some code yourself to hit the hardware directly.

As to how it gets built well the same way as any other application with perhaps a few other steps. Compile and assemble your source files, link them to form some other form of executable. If you're writing an OS kernel you'll need something to get your code into memory - however EFI and the PC BIOS can do that for you with a bit of massaging. If you're writing a window manager it can load the same way as any other application.

Cheers,

Ash
Look at it this way.

There was a time when programmers painfully programmed in machine language - zeroes and ones, yup. Then to ease the pain, mnemonics were introduced that had one to one correspondence with the earlier machine code and this is what is called "assembler". Assembler was still painful to create something real and useful without having to take note of a LOT of intricacies. That problem was solved by C. Basically, C is a high level language using which you can write low level, hardware oriented programs. Easily. But, again, building real world software wasn't really the forte of C. That doesn't mean there weren't any thing written in it. On the contrary MOST of the software that we use was/is written in C, including OS. But again, those could be written in assembler or down right machine code as well; just that it isn't very productive to do so. That issue is what C++ addresses - building software. Also, because anything that is C is also C++ (most times), you can very well write very very low level code with C++ but that would be just C and not C++. By that take, you can even embed assembler inside C and hence C++!

What I am trying to say is that different languages are meant to be used in different situations, for writing different kinds of software.

To answer your other query about building software, you must really differentiate between "building software" and "programming". The former is purely design. It usually involves white board or pencil and paper etc. There you are going to lay out a plan for your software by identifying the components and modules, the data and control paths etc. and this designing is language independent, much like how algorithm is in relation to coding. And this design stage is what one must really concentrate on.

The latter, the programming part, is important too but usually plays the second fiddle. In this stage you realize those block diagrams that you came up with in the design stage into working code. However, since different languages have different level of ease of accomplishing things, the language that is going to implement the design will also have to be kept in mind during the design stage

To summarize what I said,

** Designing is more important that coding
** C++ is meant not to do low level hardware oriented programming
** Any (most) language could be used to create any (most) software but with varied level of ease and experience helps in picking the right one for the job at hand
 
Share this answer
 
Great question !!!!!
I also had this problem two years back...
then i shifted to java and c#..did it all...cause i got no answer for such damn question,
in java and c#(This thing is most powerful on windows) you can do a rapid application development..and for your word processing software in c#...huh!!

1 hour at max!!!

but what you get from java and c# is managed code(ie. it require its runtime library for running...)

lets get back to hardware designing.

now here you can use c & c++ only.(others are also there look en.wikipedia for system design).

try to look on some os development site for more refrence ..coz there u have to much code for system level design..

but if you are going to develop for device driver utility(DDU).. then u must have knowledge of windows(for know onwards i will discuss about MS windows only..but u can replace its occurrence with linux) operation.

u need to know about interrupts because they are mostly required in DDU.
so, a knowledge of assembly is also a prequisite..{DDU is not a baby game on heavy systems..}

and about development of heavy projects in c++...

windows has set of dlls which control the gui and most of operation have a look on this code-->

C++
#include <stdio.h>
#include <conio.h>

__declspec(dllimport) int __stdcall MessageBoxA(int,char*,char*,unsigned int);

int main(){
   MessageBoxA(0,"HELLO WORLD!!", "HELLO WORLD",  0x00000040L|0x00000006L);
	return 0;
}


compile this c file in visual c++.. u will come with a great response..
(for c ++ {if you are not doing a c compilation } rewrite this code as
extern "C" __declspec(dllimport) int __stdcall MessageBoxA(int,char*,char*,unsigned int);
)

here a windows dll named user32.dll function messagebox is being called is being called

...for the rest u will learn with time...
 
Share this answer
 
v3
Comments
perilbrain 3-Aug-10 8:00am    
add #include stdio.h at least
Every example you've given there can be implemented in C++, provided you've got a suitable compiler and supporting libraries. The operating system usually supplies the libraries for accessing the hardware (although it might restrict your access to stop you breaking things). Your operating system may or may not provide some sort of GUI programming libraries (for example Windows provides a low level set of libraries called USER and GDI to do GUI programming).

So to take your example of formatting a partition - you can easily write a program to do that but you have to understand the underlying file system and the operating system calls to use to access the partition to stick the disk format on. For example in Windows you'd use CreateFile and WriteFile to get at a partition. In UNIXy systems you'd use open and write. The hardest bit is knowing what you have to do in what order then you can use C++ to implement the solution.

So your best bet is to find books/resources on the specific topics you're interested in. So if you're interested in writing a word processor on Windows in C++ then the first book to read is "Programming Windows" by Charles Petzold. That'll give you a good set of basic concepts for creating Windows applications in C (the windows API is largely C based, but usuable from C++). If you're interested in using an application framework to build it read up on that (e.g. if you're interested in using MFC then grab Jeff Prosise's "Programming Windows with MFC"). If you're interested in creating 3D games find some resources on 3D programming and brush up on your maths.

And so on...

One resource that can be "interesting" to look it is open source software. Some of it is superbly implemented and will show you how to do things in an elegant manner. A lot of it though is complete arse and should have been consigned to the recycle bin before the compiler saw it. It is a good way to learn to read code so you can get your head around common patterns and idioms and see loads of disasters and botches along the way.

Anyway, good luck! "Just" pick something simple, dive in and write it. Of course you might think something's simple until you try it, and that experience is really where the knowledge and wisdom comes from.

Cheers,

Ash
 
Share this answer
 
Comments
perilbrain 3-Aug-10 7:59am    
Reason for my vote of 5
perfect explaination for beginner
Because you are specifically talking about C and C++ there is no specific route to create an complete application. Default C and C++ are the language and the books you have read have told you only the language basics. When you choose to create an application you have to choose what you are building for. Are you going to build your own OS for example, you gave to start out with the hardware and move up until you can finally draw some kind of form on the screen. When building for Linux you have to dive into their documentation and for Windows you dive into MSDN and look for WinAPI documentation. The WinAPI are simply functions that can be used to instruct the OS what you want, for example a form and a button. This is not actual c or c++ but simply an implementation of an api that can be used. It is therefore that you won't find these kins of info in general c/c++ books. Then there is the choice of the tool you use. When you use borland cpp builder it gives you and IDE that handles most of these api tasks and let's you drag and drop controls on forms in no time. The same goed for visual studio but when you only use a compiler like opensource watcom you have to include the specific windows api headers and call the nescesary functions yourself to setup certain forms with the controls you want and implement the message loop to detect any form action. It would be advisable to download some example projects like Richard already supplied with some links. Also MSDN can help you with specific api guidance but some examples get you going the most easy way. But remember that those api's like winapi aren't part of c and/or cpp but only an OS specific implementation.

Good luck!
 
Share this answer
 
Standard C++ doesn't provide hardware low level facilities, as they depend on the target platform. You may have look at OS provided APIs for the purpose.
As about other projects, you have first to understand the problem domain, choose the scope of your solution (e.g. should it be multiplatform ?), select the right technologies (e.g. TCP/IP, ...) and then use C++ to implement the solution.
:)
 
Share this answer
 
v2
Yes, you can do all these things in C++ (or any other language), but it will involve a lot more study. You can try the MSDN[^] pages for technical notes on all the APIs supported by Microsoft. You can try Google[^] for general searches on all technologies. And you can search the articles[^] here on CodeProject. Then when you get stuck with a problem in any area of your program you can always ask further questions here.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900