STRUCTURE OF A GOOD 'C/C++' PROGRAM
There are certain basic aspects that should be kept in mind; such as the format of the code, indentation, comments, smart variables etc..
As for the basic layout, here is a tip:
As for the basic layout, here is a tip:
1> Documentation:
Example: /* Program to add two numbers.
created on: 22 sept-2005, by:urjit */
2>Linking of files and Inclusion:
This section should be used to link to all header files, external files and the library functions. Macros could also be placed in this section.
Example:
/*program to add two numbers. created by:xuxux created on: 30/6/05 */

This should contain the objective of the program, the creator's name and date if neccessary and other details about the program. It should be in the form of a multi-line comment.
Example: /* Program to add two numbers.
created on: 22 sept-2005, by:urjit */
2>Linking of files and Inclusion:
This section should be used to link to all header files, external files and the library functions. Macros could also be placed in this section.
Example: #include
#include
define PI 3.14
3>Main program:
This section should ideally contain the classes (in case of C++), global variables, filestreams, and the body of the main( ) function, containing all the sub-functions, local variables, objects etc..
4>Functions and extra comments:
This section should contain the extra information and notes about debugging if required (untill the code is perfected), other functions that are to be used in the main program (for defining the functions here, they have to be declared above their control entry; i.e., generally above main).
#include
define PI 3.14
3>Main program:
This section should ideally contain the classes (in case of C++), global variables, filestreams, and the body of the main( ) function, containing all the sub-functions, local variables, objects etc..
4>Functions and extra comments:
This section should contain the extra information and notes about debugging if required (untill the code is perfected), other functions that are to be used in the main program (for defining the functions here, they have to be declared above their control entry; i.e., generally above main).
Example:
/*program to add two numbers. created by:xuxux created on: 30/6/05 */


3 Comments:
I really enjoyed your blog. This is a cool Website Check it out now by Clicking Here . I know that you will find this WebSite Very Interesting Every one wants a Free LapTop Computer!
Hi URJIT,
Do you want to be VERY succesfull?
You will be dominating any market within days with our blog advertisement !
I only worked 1,5 months with this blog advertisement and it improved my Page rank, web site traffic and also enlargened my income by 2000%!
Try this, you will be happy you had a look!
Regards and lots of money!
http://www.superblogsubmitter.com
Isn't it time for you to get blog advertisement
Newest and most innovative blog advertisement
Urjit,
I am a C++ student taking my first programming class. Do you ever help people when they are stuck?
Juan
Post a Comment
<< Home