A Simple C++ program Through the class:
Let's use the code below to find what makes up a very simple
C++ program - one that simply prints "Hello World!" and stops. Adjust
your browser so you can see the text window below the code. Then point your
mouse at different statements in the program.
#include <iostream>
int main()
{
int a;
int b;
cout<<"Enter first
number:\n";
cin >> a;
cout <<"Enter the second number:\n";
cin>> b;
int result = a + b;
cout<<"Result is"<<" "<<result<<endl;
}
OUTPUT:
Enter the first number: 10
Enter the second number: 20
Result is:30
0 comments:
Post a Comment