Quick Search for:  in language:    
code,will,assigns,flight,seat,arrays,display,
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
C/ C++ Stats

 Code: 728,035. lines
 Jobs: 116. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for C/ C++.
socket
By Muhammad Ahmed Siddiqui on 3/6


Click here to see a screenshot of this code!Flexible Screen Designer Classes
By John Indigo on 3/6

(Screen Shot)

Click here to see a screenshot of this code!Basic 2D Transformation with Simulation
By Siva Chandran.P on 3/6

(Screen Shot)

Message Digest (LINUX) 1.0
By Vikram Shinde on 3/6


Windows Application with modified Message Loop
By Rockwell on 3/5


Inheritance of CBox
By Rockwell on 3/5


Click here to see a screenshot of this code!Awesome Screen Shot System For OpenGL And Direct3D
By James Dougherty on 3/5

(Screen Shot)

Process Killer
By Ruud Koolen on 3/5


Click here to see a screenshot of this code!Get The PIII Processor Serial Number Like Intel Format
By haitham hamed housin on 3/5

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

c++ basic all

Print
Email
 
VB icon
Submitted on: 1/28/2004 11:53:40 AM
By: Hamdi Farah 
Level: Beginner
User Rating: Unrated
Compatibility:C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++

Users have accessed this code 577 times.
 

(About the author)
 
     This code will assigns flight seat to arrays and display it using if/else do/while switch/case for/loop very best for bignenrs

 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

//**************************************
//     
//INCLUDE files for :c++ basic all
//**************************************
//     
#include <iostream>
#include <stdlib.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

//**************************************
//     
// Name: c++ basic all
// Description:This code will assigns fl
//     ight seat to arrays and display it using
//     if/else do/while switch/case
for/loop very best for bignenrs
// By: Hamdi Farah
//
// Inputs:1,2,y,n
//
// Returns:result of your input
//
// Assumes:copy and paste to compiler
//
//This code is copyrighted and has// limited warranties.Please see http://
//     www.Planet-Source-Code.com/vb/scripts/Sh
//     owCode.asp?txtCodeId=7537&lngWId;=3//for details.//**************************************
//     

//#include <StdAfx.h> 
#include <iostream>
#include <stdlib.h>
using namespace std;
int arrayfirstclass[5];	
int arrayeconomy[5];
//function
void assignfirst(void);
void assigneconomy(void);
void display(void);
//array count
int maxfirst = 0;
int maxeconomy = 0;
int eadd; // array counter
int fadd; // arrasy counter
////////////////////////////////////////
//////////////////////
int main() // main start the program with
    {
    int oneortwo = 1;
    cout << ">>>>>>>>>>>>>>>WELCOME TO HAMDI AIRLINE<<<<<<<<<<<<<<<<<<<\n\n";
    cout << "Enter 1. for first class seat\n"
    << "Enter 2. for Economy.\n"
    << "Enter 3. to display seats.\n"
    << "Enter 4. to exit the program\n";
    cin >> oneortwo;
    switch (oneortwo)
        { // start switch
        case 1:
        	assignfirst();
        case 2:
        	assigneconomy();
        case 3:
        	display();
        case 4:
        	exit(0);
        default:
        	main();
    } // end switch

return(0); }
//////////////////////////////////////// ///////// void assignfirst() { char doyou1; char moreorno1; int firstclassname; do { if(maxfirst >= 6){ cout << ">>>>>>>>>>>>>>>>>The first class is full...<<<<<<<<<<<<<<<<<<<\n"; cout << "<<<<<<<<<<<<<<<<<Next flight is at 12:30 PM>>>>>>>>>>>>>>>>>>>\n"; cout << ">>>>>>>>>>>>>>>>>Do yo want the economy seat?<<<<<<<<<<<<<<<<<\n"; cin >> doyou1; switch (doyou1) { case 'y': case 'Y': assigneconomy(); // function break; default: main(); } // end switch
} //end do while cout << "<<<<<<<<<<<<<<<<You are in First class Seat>>>>>>>>>>>>>>\n"; cout << "1.To assign seat\n"; cout << "2.To go back\n"; cin >> firstclassname; if(firstclassname == 1){ // start if maxfirst++; arrayfirstclass[fadd++] = 1; cout << "Want to add more first class? y/n\n"; cin >> moreorno1; switch (moreorno1){ case 'y': case 'Y': assignfirst(); // goto function default: main(); } //start switch
} // end if
else { main(); }
} while(moreorno1 == 'y');
}
//////////////////////////////////////// ////////////// void assigneconomy() { char doyou2; char moreorno; int economyname; //arrayfirstclass[maxfirst]; do { if(maxeconomy >= 6){ cout << ">>>>>>>>>>>>>The Economy is full...<<<<<<<<<<<<<<\n"; cout << "<<<<<<<<<<<<<Next flight is at 12:30 PM>>>>>>>>>>>>>>\n"; cout << ">>>>>>>>>>>>>Do you first class Seat?<<<<<<<<<<<\n"; cin >> doyou2; switch (doyou2) { case 'y': case 'Y': assignfirst(); // go to function break; default: main(); } //end do while } //end switch cout << ">>>>>>>>>>You are in Economy Seat<<<<<<<<<<<<<\n"; cout << "1.To assign seat\n"; cout << "2.To go back\n"; cin >> economyname; if(economyname == 1){ // start if maxeconomy++; // incrmnet add + 1 every time arrayeconomy[eadd++] = 1; cout << "want to add more economy class? y/n\n"; cin >> moreorno; switch(moreorno){ // star switch case 'y': case 'Y': assigneconomy(); default: main(); } // end switch
} // end if
else { // else end main(); } //end else
} while(moreorno == 'y');
}
//////////////////////////////////////// //////////////////////////// void display (void) { int seat = 1; int seat1 = 1; cout << "<<<<<<<<<<<<<<5 seats of first class>>>>>>>>>>>>>\n"; for(int i = 1; i <= 5; i++) // loop { // start loop cout << "Seat: " << seat++ << ">>> "; if(arrayfirstclass[i] == 0){ cout << arrayfirstclass[i] << " Empty " << endl; } else { // start else cout << arrayfirstclass[i] << " Full " << endl; } // end else } // end loop ////////////////////////////////////////////////////////////// cout << ">>>>>>>>>>5 seats of economy<<<<<<<<<<<<<<\n"; for(int j = 1; j <= 5; j++) { // start loop cout << "Seat: " << seat1++ << ">>> "; if(arrayeconomy[j] == 0){ // start if cout << arrayeconomy[j] << " Empty " << endl; } // end if else { // star else cout << arrayeconomy[j] << " Full " << endl; } // end else } // end loop main(); }
// these things dose not need cooment it // just straight forward


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | C/ C++ Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.