Hi guys, as you may know (in my username) im a noob programmer. So i want to ask help on what i did wrong? there's few error but it contradict my idea/thinking so i dont know what im doing wrong.
Please help! Thank you.
Lots of errors. You should pay attention to the error messages your compiler is giving you.
Line 16: main must be type int.
Line 34: whatsNew capitalization doesn't match the function prototype.
Lines 54-57: You can't have spaces in function names. No forward declarations for these functions.
Line 84: It's not legal to call main recursively
PLEASE USE CODE TAGS (the <> formatting button) when posting code. http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button..
Hello, by the way thank you sir for pointing that out. I already change may codes and now the problem im dealing with is in for loop in the yes and no choices. Please help
#include <iostream>
#include <conio.h>
#include <cstring>
#include <stdio.h>
usingnamespace std;
string item[4] = {"A. Cosmic Burger", "B. Quantum Burger", "C. Alpha Burger", "D. Beta Burger",};
int order[4];
int a = 200, b = 150, c = 100, d = 80;
int main()
{
system("cls");
char choice;
string name;
int s, z;
cout << "Welcome to Burger Stop!" << endl<< endl;
cout << "MENU"<< endl<< endl;
cout <<item[0]<<"\n"<<"Price: P"<<a<<"\n"<<endl;
cout <<item[1]<<"\n"<<"Price: P"<<b<<"\n"<<endl;
cout <<item[2]<<"\n"<<"Price: P"<<c<<"\n"<<endl;
cout <<item[3]<<"\n"<<"Price: P"<<d<<"\n"<<endl;
cout << "Enter your order: ";
cin>>name;
for(int i = 0; i < 4; i++)
{
if (name != item[i])
{
cout << "Is this your final order? (Yes or No?)";
cin >> choice;
if (choice == 'Yes' || choice == 'yes')
cout << "Calculating total amount..." << item[i]<<endl; // I want to display the order and the amount when the user chose Yes
break;
elseif (choice == 'No' || choice == 'no') // in my compiler theres an error of "multi-character constant"
cout << "Choose your another order again: "; // and as i am a newbie i dont know how to solve this problem. please help.
cin>>name;
}
}
system ("pause");
return 0;
}
if (choice == 'No' || choice == 'no') // in my compiler theres an error of "multi-character constant"
A character constant can only have one character, not two. If you want the user to be able to enter more than one character then choice should be a string and you should use string constants "Yes", note the use of the double quote. Remember a character const uses single quotes 'N' and can contain only one character and string constants use double quotes "Yes".
Also why all the global variables. They are not needed in this program since you only have one function, so move the declarations of those variables into main().