(C++) write a program that prompts the user to enter his or her first name and l
ID: 3741662 • Letter: #
Question
(C++) write a program that prompts the user to enter his or her first name and last name and outputs the first and last name in the same line separated with a white space. Your output should look like this (the highlighted words are the user inputs (grey color) and output of the program (blue color) - you do not have to output the highlight and color -only the names
Taylor is highlighted in grey
Test is also in grey
Taylor Test is in blue
Please enter first name: Taylor
Please enter last name: Test
Full name: Jordan Test
Explanation / Answer
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{ //variable declaration
string fname,lname;
system("Color 08"); //color changed to grey
cout<<"Please enter first name: ";
cin>>fname;
cout<<endl;
cout<<"Please enter last name: ";
cin>>lname;
cout<<endl;
system("Color 01"); //color changed to blue
cout<<"Full name: "<<fname<<" "<<lname;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.