Tuesday, December 8, 2015

C++ Program using string and iostream libraries

#include <iostream> //use for input/output
#include <string> //use for any string character

using namespace std;

int main( ) //
its return value should be an integer
{
    string name = ""; //
assignment statement in string
    int age =0; //assignment statement in int
   
    cout <<"Enter your name :\n";
        cin >> name;

        cout << "Enter your age :\n";
        cin >> age;

        cout << "your name is "<<name<<".\nyour age is "<<age<<".\n";
        system ("pause");
        return 0;
}

No comments:

Post a Comment