Hello :) can somebody help me how to put the quantity and adding a receipt
also the a1, a2, a3, a4 (for example i chose the a1 and it will ask me how many order and do you want to order more? if not it will go to the payment section and it will appear the total cost of the items i bought, the tax, the payment, the change and the receipt after the transaction) idont know what to do im so confuse :(( im just a newbie in c++.... thankyou verymuch in advance

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

#include <time.h>
#include <ctype.h>
using namespace std;
double read_double( const char * msg_prompt ){
        char buf[ 12 ] = {'\0'};
        char * end = NULL;
        double result = 0;

        for(;;){
                printf( msg_prompt );
                fgets( buf, sizeof(buf), stdin );
                result = strtod( buf, &end );
                if( *end != 0 && !isspace(*end) ){
                        puts( "Non-numeric input is not acceptable! Try again." );
                }else break;
        }
        return result;

}
main()
{
      int select, input,num,a1,a2,a3,a4,b1,b2b3,b4,b5,b6,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11;
     string Password, Username;



float x=0,total=0,cash=0,sukli=0,bilang,price,Qty;
struct tm *t;
time_t rawtime;
rawtime =time(NULL);
t=localtime(&rawtime);

     cout<<"    ***********************************************************************\n";
     cout<<"    **                                                                   **\n";
     cout<<"    **                                                                   **\n";
     cout<<"    **   **    *   **   *****   **        *******     **   **    *****   **\n";
     cout<<"    **    **  * * **    **      **        *     *    ** * * **   **      **\n";
     cout<<"    **      **   **     *****   *******   *******   **   *   **  *****   **\n";
     cout<<"    **                                                                   **\n";
     cout<<"    **                      Turo Turo Restaurant                         **\n";
     cout<<"    **                                                                   **\n";             
     cout<<"    ***********************************************************************\n";
     cout<<"\n";

     cout<<"Username: ";
     cin>>Username;
     cout<<"\n";
     cout<<"Password: ";


  string password = "";
char c = ' ';

while(c != '\r') //Loop until 'Enter' is pressed
         {
         c = getch();
         if(c == '0')
            {
            switch(getch())
               {
               default:
                  break;            
               };
            }
         else if(c == '\b')   //If the 'Backspace' key is pressed
            {
            if(password.size() != 0)  //If the password string contains data, erase last character
               {
               cout << "\b \b";
               password.erase(password.size() - 1, 1);
               }
            continue;
            }
         else if(c <= '9' && c >= '0' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')  //If user enters 1-9, a-z, or A-Z, add it to the password and display an asterisk
            {
            password += c;
            cout << "*";
            }
         else
            continue;
         }


         cout<<"\n\n\n\n\n\n\t\t\tLoading Please Wait..................."<<endl;         
         Sleep(1500);




do
{

system("cls");

first:

printf("\tTuro Turo Specialty\n\n\n");

printf("Date: %d/%d/%d ",t->tm_mon+1, t->tm_mday,t->tm_year + 1900);
printf("\t\t Time: %d:%d:%d\n\n\n", t->tm_hour,t->tm_min,t->tm_sec);

printf("[1]Rice\n");
printf("[2]Ulam\n");
printf("[3]Drinks\n");
printf("[4]Desert\n");
printf("[0]Total or Exit\n\n");


do
{ 
printf("Please choose: ");
scanf("%d",&select);

switch(select)
{
case 1:
cout<<"\n                 [Qty]                  [Price]";
cout<<"\n [a1]Unli Rice     30                     50.00              \n";
cout<<"\n [a2]Java Rice     30                     15.00              \n";
cout<<"\n [a3]Sinangag      30                     15.00              \n";
cout<<"\n [a4]Plain Rice    30                     10.00              \n"<<endl;


break;


case 2:
cout<<"\n                               [Qty]                  [Price]";
cout<<"\n [b1]Ginataang Talbos           30                     25.00              \n";
cout<<"\n [b2]Nilagang Nuggets           30                     30.00              \n";
cout<<"\n [b3]Sinigang na Kwek-Kwek      30                     30.00              \n";
cout<<"\n [b4]Sinigang na Kwek-Kwek      30                     30.00              \n";
cout<<"\n [b5]Lechon Siomai              30                     30.00              \n";
cout<<"\n [b6]Adobong Fishball           30                     30.00              \n"<<endl;

break;

case 3:
cout<<"\n                               [Qty]                  [Price]";
cout<<"\n [c1]Tubig                      30                     5.00              \n";
cout<<"\n [c2]Ice tea                    30                     15.00             \n";
cout<<"\n [c3]Chocolate                  30                     15.00              \n";
cout<<"\n [c4]Kape                       30                     10.00              \n";
cout<<"\n [c5]Coke 1.5                   30                     40.00              \n";
cout<<"\n [c6]Coke in can                30                     15.00              \n";
cout<<"\n [c7]Sprite 1.5                 30                     40.00              \n";
cout<<"\n [c8]Sprite in can              30                     15.00              \n"<<endl;
cout<<"\n [c9]Rc Malaki                  30                     20.00              \n";
cout<<"\n [c10]Rc Maliit                  30                     5.00              \n";
cout<<"\n [c11]Buko Shake                 30                     20.00              \n";


break;

case 4:
cout<<"\n                               [Qty]                  [Price]";
cout<<"\n [d1]French Fries               30                     5.00              \n";
cout<<"\n [d2]Ice Cream                  30                     15.00             \n";
cout<<"\n [d3]Fruit Combo                30                     15.00              \n";
cout<<"\n [d4]Halo-Halo                  30                     10.00              \n";
cout<<"\n [d5]Coke 1.5                   30                     40.00              \n";
cout<<"\n [d6]Coke in can                30                     15.00              \n";
cout<<"\n [d7]Sprite 1.5                 30                     40.00              \n";
cout<<"\n [d8]Sprite in can              30                     15.00              \n"<<endl;
cout<<"\n [d9]Rc Malaki                  30                     20.00              \n";
cout<<"\n [d10]Rc Maliit                  30                    5.00              \n";
cout<<"\n [d11]Buko Shake                 30                    20.00              \n";

break;



case 0:
goto second; 
default:
printf("Invalid Order\n");
break;
}
}while(select!=0);
second:
if(select == 0 && total == 0)
{
printf("Order food");
getch();
return 0;
}
else

printf("the total amount you order is %.2f\n",total);
printf("Enter amount of your cash: ");
scanf("%f",&cash);


while(cash<total)
{
printf("Kulang po\n");
printf("Enter amount of your cash: ");
scanf("%f",&cash);
}

sukli = cash - total;
printf("Ang iyong sukli ay %.2f\n",sukli);
printf("Salamat Balik ulit kayo");

getch();
select =1;
x=0,total=0,cash=0,sukli=0;

}while(select!=0);

}

a1,a2,a3,a4,b1,b2b3,b4,b5,b6,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11;

Why have you declared so many variables ? Use arrays. And I don't see you utilizing them in the code.

And for your question you need to use switch within switch, and a checking part, where the user is asked whether he wants to continue ordering or not.

can u help me what code should i replace??

Do you know class in C++ ?

If you know how to implement classes then this problem will boil down to defining 4 classes of foods i,e rice, drinks etc, and a total or exit function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.