The Greedy Ringy Manufacturing Company makes a common household item called a doflingy. The Greedy Ringy Doflingy shipping clerk is faced with the following problem: Doflingies are very delicate and must be shipped in special, very expensive, containers. These containers are available in 4 sizes: huge, large, medium, and small, which can hold, respectively, 50, 20, 5, and 1 doflingies.
Write a program that prompts a user for their name, address, and the number of doflingies ordered and displays their shipping information along with the number of huge, large, medium, and small containers needed to send the shipment in the minimum number of containers and with the minimum amount of wasted container space.
So far I have:
#include <iostream>
using namespace std;
int main ()
{
int name, city, address, state, zipCode;
cout << "Enter the name of the purchaser:\n";
cin >> name;
cout << "Enter the street address:\n";
cin >> city;
cout << "Enter city:\n";
cin >> address;
cout << "Enter state:\n";
cin >> state;
cout << "Enter zipcode:\n";
cin >> zipCode;
}
A little direction is all I need. I want to program to ask me a sequence of questions right now its just asking one question and I give it a answer and it runs through the rest.
I entered text information into my name variable which is delcared as a string. It works if I do "JohnSmith" but "John Smith" falls through.
So this is what I did to compensate.
#include <iostream>
using namespace std;
int main ()
{
string firstN, lastN, streetNum, streetName,streetSuffix, city, state1;
int zipCode;
int huge = 50;
int large = 20;
int medium = 5;
int small = 1;
int totDoflingies;
cout << "Enter name of the purchaser:";
cin >> firstN;
cin >> lastN;
cout << "Enter the street address:";
Well it should be expected. Operator>> takes values separated by whitespace characters. So if you enter "John Smith" first cin>> will get "John" and second - "Smith"