as usual, u can copy and paste this..any errors? sort it yourself..this programs just about declaring your variable and asks the user to input the value.
#include <iostream>
#include <string>
using namespace std;
int main()
{
int age, feet, inches, pounds;
string hair, eye;
cout << "My third c++ program.\n\n";
cout << "Please type your answer to each question" << "followed by ." << endl;
cout << "What is your age (years)? ";
cin >> age;
cout << "\nHow tall are you (ft in)? ";
cin >> feet >> inches;
cout << "\nHow much do you weigh (lbs)? ";
cin >> pounds;
cout << "\nWhat color is your hair? ";
cin >> hair;
cout << "\nWhat color are your eyes? ";
cin >> eye;
cout << endl << "\nYou are " << age << " years old, "
<< feet << " feet " << inches << " inches tall."
<< "\nYou weigh " << pounds << " pounds, << " have "
<< hair << " colored hair and " << eye << " colored eyes." << endl;
return 0;
}
No comments:
Post a Comment