Addition ( c = a + b & c = a * b)

By informaticar on Sep 27, 2008

To work with console in C++, you must launch the iostream.h library To Import data you are using cin, and for print you are using cout

Endl - This command signify start of new row. Cout - Just print the result of var and string's at the exit. And every cout command signify start of new row or end of the extant row. << - This command is to separete two datas. System("Pause") - When the code is performed by any Windows IDE, with this command you are pausing the program, to see result and then to close the program.

#include <iostream>
using namespace std;

void main(int argc, char *argv[])
{
    int a, b, c;
    cout <<"Enter value for a: ";
    cin >> a;
    cout <<"Enter value for b: ";
    cin >> b;
    c = a + b;
    cout <<"a + b = "<<c<<endl; //new row
    c = a * b;
    cout <<"a * b = "<<c<<endl;
    cout <<"Thank You."<<endl;
    system("PAUSE"); 
}

Comments

Sign in to comment.
informaticar   -  Oct 04, 2008

what fast writing do :)

More
 Respond  
mountaindew   -  Oct 03, 2008

To work witn console in C++, your must to lunch the iosterm.h library.

You mean "To work with console in C++, you must launch the iostream.h library" lol

More
 Respond  
Hawkee   -  Sep 27, 2008

Brings back memories, haven't done C++ for years.

More
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.