seat number

closed account (48CM4iN6)
It goes like this. Enter the number for seats to be occupied, then each seat that is chosen must output [x] . but I can only output it one at a time per input of the number of seats. can someone help me ?
What are you trying to say? Can you post some code?
closed account (48CM4iN6)
#include<iostream>
#include<string>
#include <stdio.h>
#include <time.h>


using namespace std;


int DateTime()
{
char dateStr [9];
char timeStr [9];
_strdate( dateStr);
_strtime( timeStr );
cout<<" Purchased: "<< dateStr <<" "<< timeStr<<endl
;



return 0;

}

int Ticket()
{
int ticket, i, gen , count, total;
int rand(void), payment;

cout<<" Movie Price: 200 \n"
<<" Number of Tickets Purchased: ";
cin>>ticket;

srand ( time(NULL) );

for(i=1;i<=ticket;i++)
{


gen= rand() %10000 + 100000 ;


cout<<" ticket "<<i<<" : "<<gen<<endl;

}//end outer for

total= 200 * (i-1);

do{
cout<<" Total Amount To be Payed: "<< total<< endl
<<" Enter Payment: ";
cin>> payment;


if (payment!=total)
{
cout<<" Please Enter The Correct Amount "<<endl;
system("pause");
system("cls");



}
else
{
cout<<" Thank you for Buying! "<<endl;


DateTime();
}

}while (payment!=total);
return 0;
}//end Ticket




void DisplayX( int nX, int nY)
{
int x,y;
string letter = "abcdefghijklmnopqrstuvwxyz";

for(x=0; x < 10;x++)
cout<<" "<<letter[x]<<" ";

cout<<" ";
for(x=10; x < 20;x++)
cout<<" "<<letter[x]<<" ";


cout<<endl;

for(y = 0; y<10; y++)
{
for(x=0;x<10;x++)
{
if( nX == (x+1) && nY == (y+1) )
cout<<"[X]";
else
cout<<"[ ]";
}

cout<<" ";

for(x=10; x<20; x++)
{
if( nX == (x+1) && nY == (y+1) )
cout<<"[X]";
else
cout<<"[ ]";
}
cout<<" "<<y+1<<endl;
}

cout<<"\n\n";

for(y = 10; y<20; y++)
{
for(x=0;x<10;x++)
{
if( nX == (x+1) && nY == (y+1) )
cout<<"[X]";
else
cout<<"[ ]";
}

cout<<" ";

for(x=10; x<20; x++)
{
if( nX == (x+1) && nY == (y+1) )
cout<<"[X]";
else
cout<<"[ ]";
}
cout<<" "<<y+1<<endl;
}

}


int main()
{

char cSeat, cMark;
int nSeat, nSe, n, numseat;

int x,y;
string letter = "abcdefghijklmnopqrstuvwxyz";

for(x=0; x < 10;x++)
cout<<" "<<letter[x]<<" ";

cout<<" ";
for(x=10; x < 20;x++)
cout<<" "<<letter[x]<<" ";


cout<<endl;

for(y = 0; y<10; y++)
{
for(x=0;x<10;x++)
cout<<"[ ]";

cout<<" ";

for(x=10; x<20; x++)
cout<<"[ ]";
cout<<" "<<y+1<<endl;
}

cout<<"\n\n";

for(y = 10; y<20; y++)
{
for(x=0;x<10;x++)
cout<<"[ ]";

cout<<" ";

for(x=10; x<20; x++)
cout<<"[ ]";
cout<<" "<<y+1<<endl;
}

cout<<" Enter Number of Seats To Occupy: ";
cin>>numseat;

for(n=0; n<= numseat - 1 ; n++)
{
cout<<"\nEnter Seat Number[letter number]: ";
cin>>nSe>>nSeat;

//system("cls");

DisplayX(nSe,nSeat);
cout<<" SeatNumber: "<<nSe <<" "<<nSeat<<endl;

}

Ticket();



system("pause");
return 0;
}
closed account (48CM4iN6)
The code was not succesfully sent a while ago , sorry
Topic archived. No new replies allowed.