Hey guys,
So i am in a bit of a pickle. . .My C program is being a panzy and i was just wondering if anyone could help me out with it. Here is the program:
#include <stdio.h>
int getType()
{
int Bread;
printf("Welcome to Easy Bake Bread!\n");
printf("Bread Type (1-White 2-Wholewheat): ");
scanf("%d", &Bread);
while(Bread != 1 || Bread != 2){
printf("ERROR-must enter 1 or 2 for bread type!\n");
printf("Bread Type(1-White 2-Wholewheat): ");
scanf("%d", &Bread);
}
return Bread;
}
int getSize()
{
int Size;
printf("Loaf Size (1-Regular 2-Large): ");
scanf("%d", &Size);
while(Size != 1 || Size != 2){
printf(Error-Must enter 1 or 2 for Loaf Size!\n");
printf("Loaf Size (1-Regular 2-Large): ");
scanf("%d", &Size);
}
return Size;
}
int getBakeType()
{
int BType;
printf("Baking Type (1-Machine 2-Oven): ");
scanf("%d", &BType);
while(BType != 1 || BType != 2){
printf(ERROR-Must enter 1 or 2 for Baking Type!\n!");
printf("Baking Type (1-Machine 2-Oven): ");
scanf("%d", &BType);
}
return BType;
}
main()
{
int BreadType, LoafSize, BakeType;
BreadType = getType();
LoafSize = getSize();
Baketype = getBakeType();
}
I have no errors on it (although there may be some in this pasted version, i have fixed them so it can compile). Now the problem is that when it compiles the following out put happens:
Welcome to Easy Bake Bread!
Bread type (1-White, 2-Wholewheat):
Now no matter what i enter into Bread type it always gives me the Error message of Must be 1 or 2. . . any help would be appreciated ; ;
If you want the Assignment details then just lemme know and i'll add em in...but if i get the functions working then it'll all be cake from there on.
Thanks for your help
So i am in a bit of a pickle. . .My C program is being a panzy and i was just wondering if anyone could help me out with it. Here is the program:
Spoiler:
#include <stdio.h>
int getType()
{
int Bread;
printf("Welcome to Easy Bake Bread!\n");
printf("Bread Type (1-White 2-Wholewheat): ");
scanf("%d", &Bread);
while(Bread != 1 || Bread != 2){
printf("ERROR-must enter 1 or 2 for bread type!\n");
printf("Bread Type(1-White 2-Wholewheat): ");
scanf("%d", &Bread);
}
return Bread;
}
int getSize()
{
int Size;
printf("Loaf Size (1-Regular 2-Large): ");
scanf("%d", &Size);
while(Size != 1 || Size != 2){
printf(Error-Must enter 1 or 2 for Loaf Size!\n");
printf("Loaf Size (1-Regular 2-Large): ");
scanf("%d", &Size);
}
return Size;
}
int getBakeType()
{
int BType;
printf("Baking Type (1-Machine 2-Oven): ");
scanf("%d", &BType);
while(BType != 1 || BType != 2){
printf(ERROR-Must enter 1 or 2 for Baking Type!\n!");
printf("Baking Type (1-Machine 2-Oven): ");
scanf("%d", &BType);
}
return BType;
}
main()
{
int BreadType, LoafSize, BakeType;
BreadType = getType();
LoafSize = getSize();
Baketype = getBakeType();
}
I have no errors on it (although there may be some in this pasted version, i have fixed them so it can compile). Now the problem is that when it compiles the following out put happens:
Spoiler:
Welcome to Easy Bake Bread!
Bread type (1-White, 2-Wholewheat):
Now no matter what i enter into Bread type it always gives me the Error message of Must be 1 or 2. . . any help would be appreciated ; ;
If you want the Assignment details then just lemme know and i'll add em in...but if i get the functions working then it'll all be cake from there on.
Thanks for your help