How do I allow 2 words entered into my program?
Currently my below program works but when user enters 2 words in pizza name variable the program shuts down...
Code:
//Jose Gonzales, key: #c++02, 45
#include <iostream.h>
struct pizza
{
char companyname[30];
float diameter;
float weight;
};
int main()
{
pizza analysis = {};
cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
cout << " --William Wingate's Pizza-Analysis Service-- \n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "Enter the name of the Pizza Company: \n";
cin >> analysis.companyname;
cout << "Enter the diameter of pizza: \n";
cin >> analysis.diameter;
cout << "Enter the weight of the pizza: \n";
cin >> analysis.weight;
cin.get();
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "User entered information... \n";
cout << "\n";
cout << "Pizza Company: " << analysis.companyname << "\n";;
cout << "Pizza Diameter: " << analysis.diameter << "\n";
cout << "Pizza weight: " << analysis.weight << "\n";
cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
cin.get(); //take out all cin.get statements...
return 0;
}
Jose