- Aug 25, 2001
- 382
- 0
- 0
This is quite annoying since:
1. We have a sub today...
2. I can't figure it out bymyslef...
3. Help?
The problem is like this; everything goes cool, till the last phase, where it loops itself, and doesn't display letters, but numbers for the pizza diameter *note: compile and run the programm, and ya shall see what i mean*. I tried everything, but still it wont work....
Any ideas on how to fix it?
Code:
//Pizza.cpp
//Gene Romm
#include <iostream>
#include <cstring>
using namespace std;
const int MAX=80;
const int NUM=5;
enum Pizzas{Small, Medium, Large, X_Large};
struct pizza
{
char name[MAX];
Pizzas diameters;
double weight;
};
void getName(pizza ar[], int i);
void getDiameter(pizza ar[], int x);
void getWeight(pizza ar[], int m);
void showall(pizza ar[], int i);
int main()
{
pizza company
1. We have a sub today...
2. I can't figure it out bymyslef...
3. Help?
The problem is like this; everything goes cool, till the last phase, where it loops itself, and doesn't display letters, but numbers for the pizza diameter *note: compile and run the programm, and ya shall see what i mean*. I tried everything, but still it wont work....
Any ideas on how to fix it?
Code:
//Pizza.cpp
//Gene Romm
#include <iostream>
#include <cstring>
using namespace std;
const int MAX=80;
const int NUM=5;
enum Pizzas{Small, Medium, Large, X_Large};
struct pizza
{
char name[MAX];
Pizzas diameters;
double weight;
};
void getName(pizza ar[], int i);
void getDiameter(pizza ar[], int x);
void getWeight(pizza ar[], int m);
void showall(pizza ar[], int i);
int main()
{
pizza company
- ;
for (int i=0; i<NUM; i++)
{
getName(company, i);
getDiameter(company, i);
getWeight(company, i);
showall(company, i);
}
return 0;
}
void getName(pizza ar[], int i)
{
cout << "What is your company's name? ";
cin.getline(ar.name, MAX);
return;
}
void getDiameter(pizza ar[], int x)
{
char Small=1;
char Medium=2;
char Large=3;
char X_Large=4;
cout<<"Please the number for the corresponding diamteres of the pizza:\n";
cout<<"1 - Small\n";
cout<<"2 - Medium\n";
cout<<"3 - Large\n";
cout<<"4 - X_Large\n";
cin>>x;
{
if (x==1)
cout<<"Your pizza is going to be small!\n";
else if (x==2) cout<<"Your pizza is going to be medium-sized!\n";
else if (x==3) cout<<"Your pizza is going to be quite large!\n";
else if (x==4) cout<<"You sure you want this huge thing for dinner...?\n";
}
return;
}
void getWeight(pizza ar[], int i)
{
cout<<"Now would you please enter the weight for your pizza in pounds?";
cin >> ar.weight;
return;
}
void showall(pizza ar[], int i)
{
cout<<"\n";
cout<<"Lets see, your company's name is "<<ar.name <<",\n";
cout<<"Your prefered pizza size is "<<ar.diameters <<", \n";
cout<<"And the weight of the pizza is "<<ar.weight <<".\n";
return;
}
