Basic Structure of a C++ program

Adding of two numbers: This is a basic program to add two integer type variables by using a C++ program.

#include<iostream.h> //header file
#include<conio.h>    //heafer file
void main()
{
int number1, number2, sum;
cout<<"Enter two numbers to be added";
cin>>number1;
cin>>number2;
/* cin>>number1>>number2;
Can also be used.*/
sum= number1+number2;
cout<<"The sum is "<<sum;
getch();
}

kaliadevansh has written 15 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>