-
I need help with a code
Code:
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
char answer;
int sel;
float ground_shipping = 0.00, thirdDay_Air = 0.00, secoundDay_Air = 0.00;
float overnight;
main()
{
cout<<" Shopping Menu";
cout<<"\n Please press Y to continue, or N to exit";
cin>>answer;
answer = toupper(answer);
while(answer=='Y')
{
cout<<" Yes-we-can-ship-it Shopping Menu ";
cout<<"\n 1)Ground Shipping ";
cout<<"\n 2)3rd Day Air ";
cout<<"\n 3)2nd Day Air ";
cout<<"\n 4)Overnight ";
cout<<"\nSELECTION: ";
cin>>answer;
if(sel = 1)
{
ground_shipping = 5.00;
}
if(sel = 2)
{
thirdDay_Air = 7.50;
}
if(sel = 3)
{
secoundDay_Air = 8.50;
}
if(sel = 4)
{
overnight = 10.00;
}
cout<<"\n Enter the ground shipping";
cin>>ground_shipping;
cout<<"\n Enter the 3rd Day Air amount";
cin>>thirdDay_Air;
cout<<"\n Enter the second day air amount";
cin>>secoundDay_Air;
cout<<"\n Enter the overnight";
cin>>overnight;
cin>>answer;
answer = toupper(answer);
}
return 0;
}
Code tags added by Hammer
-
Post a specific question.
Kuphryn
-
Three great points of advice.
Numero uno 1) USE CODE TAGS
2) Indent your code
3) Like Kuphryn suggested Tell us what you need help with.
-
like already said, please ask a question.
but anyway, one problem i see is that you aren't using "if" statements correctly.
= doesn't do a comparison, it is used for setting a variable.