Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Write a c++ program that will prompt a user to input one word answers.docx

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige

Hier ansehen

1 von 2 Anzeige

Write a c++ program that will prompt a user to input one word answers.docx

Herunterladen, um offline zu lesen

Write a c++ program that will prompt a user to input one word answers to the following questions.
What is your name? What state do you live in? What year did you start college?
Once the user has entered the answer to each question, output as follows:
Hello,
My name is name. I am from state. I enrolled in college in year.
Solution
#include <iostream>
using namespace std;
int main()
{
int year;
char name[20],state[20];
cout<<\"What is your name? : \";
cin>>name;
cout<<\"What state do you live in?: \";
cin>>state;
cout<<\"What year did you start college? : \";
cin>>year;
cout<<\"\ Hello,\";
cout<<\"\ My name is \"<<name<<\".\";
cout<<\"I am from \"<<state<<\".\";
cout<<\"\ I enrolled in college in \"<<year<<\".\";
}
.

Write a c++ program that will prompt a user to input one word answers to the following questions.
What is your name? What state do you live in? What year did you start college?
Once the user has entered the answer to each question, output as follows:
Hello,
My name is name. I am from state. I enrolled in college in year.
Solution
#include <iostream>
using namespace std;
int main()
{
int year;
char name[20],state[20];
cout<<\"What is your name? : \";
cin>>name;
cout<<\"What state do you live in?: \";
cin>>state;
cout<<\"What year did you start college? : \";
cin>>year;
cout<<\"\ Hello,\";
cout<<\"\ My name is \"<<name<<\".\";
cout<<\"I am from \"<<state<<\".\";
cout<<\"\ I enrolled in college in \"<<year<<\".\";
}
.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Weitere von lez31palka (20)

Aktuellste (20)

Anzeige

Write a c++ program that will prompt a user to input one word answers.docx

  1. 1. Write a c++ program that will prompt a user to input one word answers to the following questions. What is your name? What state do you live in? What year did you start college? Once the user has entered the answer to each question, output as follows: Hello, My name is name. I am from state. I enrolled in college in year. Solution #include <iostream> using namespace std; int main() { int year; char name[20],state[20]; cout<<"What is your name? : "; cin>>name; cout<<"What state do you live in?: "; cin>>state; cout<<"What year did you start college? : "; cin>>year; cout<<" Hello,"; cout<<" My name is "<<name<<"."; cout<<"I am from "<<state<<"."; cout<<" I enrolled in college in "<<year<<"."; }

×