C++ Program Structure

Example of C++ Program Structure :-

 

#include<iostream.h>
#include<conio.h>
void main()
{
int a=10,b=20,c;
c=a+b;
cout<<“The sum of a and b is:”<<c<<endl;
getch();
}

Result of C++ Program Structure :-

 

C++ Example

 

void :-
void indicate that a function does not return
a value and the other is to declare a generic pointer.
cout:-
to display output data onto the screen,
we will use ‘cout’ operator followed by ‘insertion ‘ operator.
example :- cout<<c;

main():-                                                                                                       

Execution of Program always start from main() function. Compiler or Interpreter always start execution from main() function.

 




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top