serfrancois
Addict
pag inalis po mag eerror e san po ba ilalagay yung currentcinemaIndex at cinema[0][0]Saka include mo sa taas yung
#include<string>
pag inalis po mag eerror e san po ba ilalagay yung currentcinemaIndex at cinema[0][0]Saka include mo sa taas yung
#include<string>
Wala yun. Hindi naman ginamit yun sa code. Kung babasahin mo lahat makikita mo.pag inalis po mag eerror e san po ba ilalagay yung currentcinemaIndex at cinema[0][0]
napagana ko na siya paps salamat, may tanong pa sana ko paps e pwede ka ba ma iadd sa fbWala yun. Hindi naman ginamit yun sa code. Kung babasahin mo lahat makikita mo.
Hindi ako nagpapaadd sa facebook eh. Sana maintindihan mo. Yung mga nakikita ko lang sa personal mga friends ko.napagana ko na siya paps salamat, may tanong pa sana ko paps e pwede ka ba ma iadd sa fb
Click mo lang yung "+" sign tapos lagay mo sa code tag.sige paps hehe. pano icomment yung codes paps para di siya mahaba di ba may tinatype dun para mapakita ko sayo tapos ask ko na din pano ko siya gagawan ng goto para bumabalik siya
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string cinema[9][6] =
{
{"Cinema 1", "A", "Avengers Infinity War [PG]", "200", "10:30am - 12:30pm", "12:30pm - 2:30pm"},
{"Cinema 1", "B", "Ant Man [PG]", "230", "2:30pm - 4:30pm", "4:30pm - 6:30pm"},
{"Cinema 1", "C", "Rampage [PG]", "250", "6:30pm - 8:30pm", "8:30pm - 10:30pm"},
{"Cinema 2", "A", "The How's of Us [G]", "210", "10:30am - 12:30pm", "12:30pm - 2:30pm"},
{"Cinema 2", "B", "How I Met Your Mother [PG]", "220", "2:30pm - 4:30pm", "4:30pm - 6:30pm"},
{"Cinema 2", "C", "Fifty Shades [SPG]", "215", "6:30pm - 8:30pm", "8:30pm - 10:30pm"},
{"Cinema 3", "A", "The Nun [SPG]", "220", "10:30am - 12:30pm", "12:30pm - 2:30pm"},
{"Cinema 3", "B", "Anabelle [SPG]", "225", "2:30pm - 4:30pm", "4:30pm - 6:30pm"},
{"Cinema 3", "C", "The Purge [SPG]", "190", "6:30pm - 8:30pm", "8:30pm - 10:30pm"}
};
int cinemaIndex = 1;
string cinemaInput;
string movieInput;
string timeInput;
int seatInput;
bool successPicking = false;
float total = 0;
string currentCinemaIndex =cinema[0][0];
dito:
cout << "<<<<<<[Welcome to World Cinema]>>>>>>\n";
cout << "Cinema List:\n";
cout << "======================================\n";
cout << cinema[0][0] << ":\n";
//Show the môvięs in each cinema
for(int i = 0; i < 9; i++)
{
if(currentCinemaIndex != cinema[i][0])
{
currentCinemaIndex = cinema[i][0];
cout<< "======================================\n";
cout<< cinema[i][0] << ":\n";
}
cout<< "[" << cinema[i][1] << "] " << cinema[i][2] << "\n";
}
//Pick what cinema
cout<< "\n\nSelect cinema [1|2|3]: ";
cin >> cinemaInput;
cinemaInput = "Cinema " + cinemaInput;
if (cinemaInput == "0")
{
goto dito;
}
else
{
cout<< "Select what movie [A|B|C]: ";
cin >> movieInput;
}
cout<< "======================================\n";
cout<< "Selected:\n\n";
//Search the picked cinema and môvię then output in the screen
for(int i = 0; i < 9; i++)
{
if(cinema[i][0] == cinemaInput && cinema[i][1] == movieInput)
{
cout<< cinema[i][2] << "\n";
cout<< "Price: P " << cinema[i][3] << "\n";
cout<< "Time Available: \n";
cout<< "[1]" << cinema[i][4] << "\n";
cout<< "[2]" << cinema[i][5] << "\n";
cout<< "[3]" << "CANCEL\n\n";
while (true)
{
cout<< "Select time [1|2]: ";
cin >> timeInput;
if(timeInput == "1")
{
timeInput = cinema[i][4];
successPicking = true;
break;
}
else if (timeInput == "2")
{
timeInput = cinema[i][5];
successPicking = true;
break;
}
else if (timeInput == "3")
{
system("cls");
break;
}
else
{
cout<< "Invalid input, please try again...";
}
}
if(successPicking)
{
cout<< "How many seats or tickets: ";
cin >> seatInput;
stringstream temp(cinema[i][3]);
int z=0;
temp >> z;
total = z*seatInput;
cout<< "======================================\n";
cout<< "movie\n";
cout<< cinema[i][2] << "\n";
cout<< "Time: " << timeInput << "\n";
cout<< "Price: P " << cinema[i][3] << "\n";
cout<< "Seats: " << seatInput << "\n";
cout<< "Total: " << total;
}
else
{
break;
}
}
}
return 0;
}
[/QUOTE
Ilagay mo sa loob ng while loop yung process.
decimal lang ba? Saan mo gagamitin? Yung code sa last reply mo?last question po, pano siya gawin para di mag accept ng decimal, kunwari mag input ng demical mag eerror siya dapat
decimal lang ba? Saan mo gagamitin? Yung code sa last reply mo?
subukan mo yung isdigit(input).kunwari sa tickets, pano if nag input ako ng 1.5 bawal dapat mag accept 1.5
Sir. Pwedi po makahinge nang code nang c++ sample code using function? Pero di gagamitin si void.
Looping lang poyun... Pwede naman yata kahit dina i function yon diba paps?Ano yan? Para saan yung January to December?
Kung function yan mas iikli yung code. Pwede ifunction yan.Lo
Looping lang poyun... Pwede naman yata kahit dina i function yon diba paps?