Answer to Question #318985 in C++ for fiona

Question #318985

Create a c++ program that would ask the user to enter their personal information : Lastname, First name, Middle Name, Birthday, Age, Gender and Permanent address. The program must display all the information input by the user.



1
Expert's answer
2022-03-27T09:05:43-0400
#include <iostream>
#include <string>
using namespace std;


int main() {
    string last, first, middle;
    int age;
    string birthday;
    string gender;
    string address;


    cout << "Enter you lastname: ";
    cin >> last;


    cout << "Enter you firstname: ";
    cin >> first;


    cout << "Enter you middlename: ";
    cin >> middle;


    cout << "Enter your birthday: ";
    cin >> ws;
    getline(cin, birthday);


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


    cout << "Enter your gender: ";
    cin >> gender;


    cout << "Enter your permanent address: ";
    cin >> ws;
    getline(cin, address);


    cout << "Hello " << first << " " << middle << " " << last << endl;
    cout << "Your birthday is " << birthday
         << " and now you are " << age << " years old." << endl;
    cout << "You are " << gender << endl;
    cout << "and you live at " << address << endl;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog