Theatre ticket codes
Oct 29, 2015 at 9:27am UTC
hello i m writing basic theatre ticket program. While writing now i can't solve one problem. When program ll print seats turning symbols to ascii. Because used int array and i want write ! And *. => cout<< array[i][j]
How can i fix this. Just need tip
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 49 50
#include<iostream>
using namespace std;
int main()
{
const char dolu = '!' ;
const char bos = '*' ;
int c,r,sira,sayi;
cout<<"Salondaki Sıra Sayısını veriniz : " ;
cin>>r;
cout<<"Salondaki Her Sırada Koltuk Sayısını Veriniz : " ;
cin>>c;
int **array= new int *[r];
cout<<"Salon Düzeni\n" ;
cout<<"------------\n" ;
for (int i=0;i<c;i++)
{
array[i]= new int [c];
}
for (int i=0;i<r;i++)
{
for (int j=0;j<c;j++)
{
array[i][j]=bos;
cout<<"*" ; //array[m][n]<<"o";
}
cout << endl;
}
cout<<"\nMerhaba kaçıncı sıradan yer istersiniz? (Çıkmak için 0) :" ;
cin>>sira;
cout<<"\nKaç kişilik yer istiyorsunuz? : " ;
cin>>sayi;
if (array[sira][sayi] == dolu)
{
cout<<"Dolu" ;
}
else
array[sira][sayi]=dolu;
for (int i=0;i<r;i++){
for (int j=0;j<c;j++){
cout << array[i][j];
}
cout<<endl;
}
return 0;
}
Oct 29, 2015 at 11:17am UTC
Use a char arrays instead of an int arrays at lines 14 and 19.
line 17: Should be for (int i=0; i<r ; i++)
?
Topic archived. No new replies allowed.