Thread: Reservation Program Help

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    2

    Reservation Program Help

    I am creating a reservation program for a small company that reserves a stands at trade fairs.

    The program requires a data file that contains:
    - Trade Fair Codes
    - Descriptions
    - Costs
    - Stands available to reserve

    The user types in a Trade Fair code which is then check to see if it exists from the file data and then can then they can add reservations (take away from available stands) or cancel reservations (add to available stands. After this the new amount of available stands is displayed.

    Data is then saved to the data file.

    I'm confused on how exactly all this would work and in what order, could anyone help by giving me some breif psuedo code?

    I know the data from the file must be put into an array, but how would that work? Also how would the program check the code exisits?

    Thanks for any help
    Last edited by Ricey; 01-25-2006 at 02:40 PM.

  2. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Here is an example header file and driver program.. I'll leave the functions up to you


    Code:
    #include<iostream>
    #include<fstream>
    #include<string>
    using namespace std;
    
    
    struct node
    {
         string code;
         string description;
         double cost;
         string available_stands[10];
    };
    
    
    int main()
    {
         node myNode[10];
    
         do{
                   switch(menu())
                   {
                        case 1:  add_node(myNode);
                        break;
                        case 2:  delete_node(myNode);
                        break;
                        case 3:  list_all_reservations(myNode);
                        break;
    
                        default:  input_error_message();
                   }
    
         }while(again());
    
    return 0;
    }
    Last edited by The Brain; 01-26-2006 at 07:08 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    2
    Quote Originally Posted by The Brain
    Here is an example header file and driver program.. I'll leave the functions up to you


    Code:
    #include<iostream>
    #include<fstream>
    #include<string>
    using namespace std;
    
    
    struct node
    {
         string code;
         string description;
         double cost;
         string available_stands[10];
    };
    
    
    int main()
    {
         node myNode;
    
         do{
                   switch(menu())
                   {
                        case 1:  add_node(myNode);
                        break;
                        case 2:  delete_node(myNode);
                        break;
                        case 3:  list_all_reservations();
                        break;
    
                        default:  input_error_message();
    
         }while(again());
    
    return 0;
    }
    Thanks, that's made things a bit clearer.

    Still a bit confused about passing data between an array and the fil and also checking the inputted trade fair code against to see if it exists

    Any help?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM