468,512 Members | 1,426 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

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;

}
Oct 19 '06 #1
2 3627
vermarajeev
180 100+
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
Oct 19 '06 #2
tyreld
144 100+
Remove the getline between main and the first bracket.

Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3. ...
  4. }
  5.  
  6. INSTEAD OF
  7.  
  8. int main()
  9.  
  10. getline()
  11. {
  12. ...
  13. }
  14.  
Oct 19 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

83 posts views Thread by Alexander Zatvornitskiy | last post: by
16 posts views Thread by Bhushit Joshipura | last post: by
1 post views Thread by pai | last post: by
10 posts views Thread by fred.zakity | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.