I need help with a code

This is a discussion on I need help with a code within the C++ Programming forums, part of the General Programming Boards category; 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, ...

  1. #1
    yogibhag
    Guest

    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

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Post a specific question.

    Kuphryn

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    230
    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.
    C++ Rules!!!!
    ------------
    Microsoft Visual Studio .NET Enterprise

  4. #4
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 09:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 08:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21