I keep getting a declaration syntax error...Can anyone help?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kellymart87
    New Member
    • Oct 2006
    • 1

    I keep getting a declaration syntax error...Can anyone help?

    //remain.cpp

    #include <iostream.h>
    #include <conio.h>



    int main()
    getline ()

    {

    int beef = 2;
    int ham = 3;
    int turkey = 4;
    int american = 5;
    int swiss = 6;
    int lettuce = 7;
    int tomatoe = 8;
    int pickle = 2;
    int mayo = 1;
    int meat;
    int cheese;
    int fixings;
    int total;


    cout << "What type of meat do you want (choose one)?\n";
    cout << "beef\n";
    cout << "ham\n";
    cout << "turkey\n";
    getline(cin, meat);

    cout << "What type of cheese do you want (choose one)?\n";
    cout << "american\n ";
    cout << "swiss\n";
    getline(cin, cheese);

    cout << "What fixings do you want (choose all if wanted)?\n";
    cout << "lettuce\n" ;
    cout << "tomatoe\n" ;
    cout << "pickle\n";
    cout << "mayo\n";
    getline(cin, fixings);

    meat = turkey + ham + beef;
    cheese = american + swiss;
    fixings = lettuce + tomatoe + pickle + mayo;
    total = meat + cheese + fixings;

    cout << "Your total cost is " << total;

    getch();

    return 0;

    }
  • vermarajeev
    New Member
    • Aug 2006
    • 180

    #2
    I'm unable to understand what r u trying to do with your code....

    Firstly, could you please tell me what do you mean when you write

    int main()
    getline ()
    {
    return 0;
    }

    If you are able to reply me correctly, I'm sure you will fix that problem yourself...

    Thankx

    Comment

    • tyreld
      New Member
      • Sep 2006
      • 144

      #3
      Remove the getline between main and the first bracket.

      Code:
      int main()
      {
      ...
      }
      
      INSTEAD OF
      
      int main()
      
      getline()
      {
      ...
      }

      Comment

      Working...