Successfully reported this slideshow.
Your SlideShare is downloading. ×

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

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 2 Ad

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

Download to read offline

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<<\".\";
}
.

Advertisement
Advertisement

More Related Content

More from lez31palka (20)

Advertisement

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<<"."; }

×