POS System using c++

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.


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

using namespace std;

void ourFOOD();
void burgCafe();
void burgDesert();
void whatsNEW();
void error();

string name[4];

main()
{
system("cls");

cout << "Welcome to Burger Burgers!" << endl<< endl;

cout << "A. Our Food \n"
<< "B. Burg Cafe \n"
<< "C. Burg Desert \n"
<< "D. What's NEW()"
<< "\n Enter your Choices: ";

int choice;
cin >> choice;

(choice == 1)? ourFOOD() :
(choice == 2)? burgCafe() :
(choice == 3)? burgDesert() :
(choice == 4)? whatsNew() : error();
}

void ourFOOD()
{
for(int i = 0; i < 4; i++)
{
system("cls");
char choice;

cout << "MENU"<< endl<< endl;

cout << "A. Cosmic Burger";
cout << "B. Quantum Burger";
cout << "D. Alpha Burger";
cout << "E. Beta Burger";

cout << "\n Enter your Choices: ";


(choice == 1)? Cosmic Burger() :
(choice == 2)? Quantum Burger():
(choice == 3)? Alpha Burger() :
(choice == 4)? Beta Burger() : error();

if (i != 4)
{
cout << "Please select only 4 choices in the menu. Thank you";
break;
}
}

main();
}
void burgCafe()
{

}
void burgDesert()
{

}
void whatsNEW()
{

}
void error()
{
cout << "Invalid input. Please enter another number.\n";
system("pause");
main();
}
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..
Last edited on
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <conio.h>
#include <cstring>
#include <stdio.h>

using namespace 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;
			else if (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;
}	
Last edited on
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().


Topic archived. No new replies allowed.