hey guy I'm new and a noob in c++
need help with this simple program
Airline Booking System
write a code to solve these problems as following :
1- Define a variable represents the booking zone.
2- Display these sentences on the screen.
press 1 : to reserve in business man zone .
press 2 : to reserve in Normal people zone.
3- Define variables represents 5 seats for each zone (counter for each zone).
4- Reserve a ticket for one person (verify if there is empty seats than decrease the counter).
5- Repeat the above code to five seats.
this is my code and I know there is something wrong I don't know what !!
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Press 1 : to reserve in business zone"<<endl;
cout<<"Press 2 : to reserve in economy zone"<<endl;
for (int i=0;i>=5;i=i+1)
{
cin>>a;
cout<<i;
while
(a=!5)
cout<<"you have reserved in business zone"<<endl;
}
for (int i=0;i>=5;i++)
{
cin>>b;
cout<<i;
}
while
(b=!5)
cout<<"You reserved in economy zone"<<endl;
You and your class need to learn that school is for LEARNING if you don't want to learn c++ get a new career I've seen this same assignment several times this week.
Actually they are all from you.. Can you please TRY and not keep posting the same assignment saying "do my homework for me so I can pass my class without even trying." Please stop creating the same thread also http://www.cplusplus.com/forum/beginner/1/
When you have an actual question we can answer but you have yet to ask a question.
Are you asking why your code has an infinite loop? That would be because of your while loop inside of the first for loop while( a != 5 ) std::cout << "blah blah" << std::endl;
You may want to reconsider that while statement. You also have this problem in the second loop. I would consider naming your variables with relevant names also not just a and b I have no clue what those are supposed to be. Also please use the code tags
[code][/code]
or the <> button when you edit/post a reply.
And saying you don't know what is wrong with your code is not a question. A question is like I think I have a problem at line ... because I wanted it to do this... but it is doing this.. what can I do to fix it?
Yeah I didn't even notice that on his. Also you should consider using the standard way to write for loops for( int i = 0; i < MAX; ++i )
Also what is the purpose of outputting i? It will look like 012345.
How about you show us your "code." Then we can try to help you. You already posted 2 threads with write my code for me don't make this a third..or I'm going to blacklist you.
Why use a setter constructor in the zone class instead of a initialized list? Also your print function seems a bit weird Why not just make it void and just output the message on the function call or even overload operator <<. Also you know he is just going to copy/paste more than likely right? You should at least wait for him to "try" the assignment especially if they post the same topic 3 times within two days.
You're right about the initializer lists. As for my print method, I like it to be flexible so that I can print to the screen or pass in a filestream dynamically.