Professional Documents
Culture Documents
Drink Price Fefef
Drink Price Fefef
Initialization Data
Number
Drink
Cost in
Name
machine
Pepsi RM2.00 20
Sprite RM1.20 30
Milo RM3.00 20
Each time the program runs, it should enter a loop that
performs the following steps:
Input Validation:
o
/* Assignment 2 (Grouping)
Group Name =
Group member :
*/
#include <iostream>
#include <iomanip>
#include <fstream>
char tempat[row][col];
// Function Declaration
void displayChart();
int menu();
void pilihanpenuh(int);
void harga();
int main()
int rege[15] ;
//Opening an input file, to read & transer the data into rege array
ifstream myfile("priceofticket.txt");
if (!myfile)
if (myfile.is_open())
while ( true)
{
myfile >> x; //copy data into array
if (myfile.eof())
break;
rege[kotakharga++] = x;
for (int Nrow = 1; Nrow <= row ; Nrow++) //initializing the empty seat
tempat[Nrow][Ncol] = KOSONG;
menu ();
do
cout << "==> Total number ticket sale & price [4] <==\n" ;
switch (option)
case 1:
cout <<"ROW " << (i+1) << "\t: RM "<< rege[i] << endl;
break;
case 2:
displayChart();
break;
case 3:
do
if (tempat[tepi][bawah] == '*')
cout << "\nSorry that seat is sold-out, Please select a new seat.";
else
cout << "Price ticket: " << kos << "\n \n";
cout << "Enter 1(YES) to comfirm purchase, 2()NO) if you are not
comfirmed";
if (answer == 1)
cout << "\nYour ticket purchase has been confirmed." << endl;
tempat[tepi][bawah] = PENUH; // changing the seat from
KOSONG(#) to PENUH(*) in array
totalSeat-- ;
else if (answer == 2)
cout << "\nEnter 1(YES) if you want to look another seat, 2(NO)
if you want to go to Menu";
cout << "\nEnter 1(YES) if you want to look another seat, 2(NO) if you
want to go to Menu";
while (Quit==1);
break ;
case 4:
cout << "\nTotal ticket sold :RM " << semua<< endl;
break ;
case 5:
cout << "\nThank You for purchasing ticket with us. Have a nice day!\n";
break;
while(option != 5);
// Function Definiton
int menu()
{ int pilih ;
void displayChart()