Input and Output

  • + 0 comments

    you must have to include the String library

    using namespace std;

    int main() {

    string name = "";
    int age = 0;
    
    cout << "What is you name?" << endl;
    cin >> name;
    
    cout << "How old are you?" << endl;
    cin >> age;
    
    printf("Hello, %s, nice to meet you. You have %i years right?", name.c_str(), age);
    
    return 0;
    

    }