Fill in the blanks and complete the outputs of these programs. 1: This program will demonstrate the use of strings. Fill in the blanks and complete the output of this program. #include #include using namespace std; int main() { string name; cout<<"What is your full name?"<> name; // What is your input?_________________________________ cout<<"Good afternoon, "< #include using namespace std; int main() { string firstname; string lastname; string phrase; cout<<"Please enter your first name: "<> firstname; cout<<"Please enter your last name: "<> lastname; phrase = firstname + " " + lastname; // what is phrase now? __________________ phrase += " go go go!"; // what is phrase now? __________________ int i=0; while (phrase[i]) { cout<
Fill in the blanks and complete the outputs of these programs.
1: This
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout<<"What is your full name?"<<endl;
cin >> name; // What is your input?_________________________________
cout<<"Good afternoon, "<<name<<endl;
return 0;
}
Complete the output:
What is your name?
______________________
______________________
2: This program will demonstrate the use of strings. Answer the questions about phrase string. What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
int main()
{
string firstname;
string lastname;
string phrase;
cout<<"Please enter your first name: "<<endl;
cin >> firstname;
cout<<"Please enter your last name: "<<endl;
cin >> lastname;
phrase = firstname + " " + lastname; // what is phrase now? __________________
phrase += " go go go!"; // what is phrase now? __________________
int i=0;
while (phrase[i])
{
cout<<phrase[i];
i++;
}
cout<<endl;
return 0;
}
Complete the output:
Please enter your first name:
______________________
Please enter your last name:
______________________
______________________
Step by step
Solved in 2 steps with 2 images