Hi,
while doing my assignment im somehow stucked somewhere which i didnt know why and i need some help. i have jus started learning abt c++. so im jus using some basic syntax
#include<iostream>
using namespace std;
int main()
{
int selclass,i,position;
char ch;
int seats[100]={0}; //array
while(true)
{
cout<<"Choose your class\n";
cout<<"1.Business Class\n";
cout<<"2.First Class\n";
cout<<"3.Economic Class\n";
cin>>selclass;
switch(selclass)
{
switch(selclass)
{
case 1:
cout<<"Seats available \n";
for(i=1;i<=20;i++)
{
if (seats[i] ==0) cout<<i<<" ";
}
cout<<"\nChoose your preferred seat\n";
cin>>position; //User's selected seat
if (position > 20)
{
cout<<"Seat Number: "<<position<<" is not available for Business Class\n";
}
else{
if (seats[position]=0)
cout<<"You have booked "<<position<<".Thank you\n"; //this sentence dont appear
seats[position]=1; //to change the array from 0 to 1
cout<<"You have booked "<<position<<".Thank you\n"; //this sentence appear if this line is added in but my array doesnt work
}
break;
i will require to add 1 more else at the very bottom for users who have selected an occupied seat. Please help