i need help anyone please

This is a discussion on i need help anyone please within the C++ Programming forums, part of the General Programming Boards category; hi everyone, i ran out of ideas on how to fix this problem. i running a program with an output ...

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

    Red face i need help anyone please

    hi everyone, i ran out of ideas on how to fix this problem.
    i running a program with an output sample below
    ++++++++++++++++++++++++++++++++++++++++++++++

    Input the date:
    2
    3
    2006
    Input appointment time:
    4
    2/3/2006
    9am Available
    10am Available
    11am Available
    12pm Available
    1pm Available
    2pm Available
    3pm Available
    4pm Booked
    ++++++++++++++++++++++++++++++++++++++++++++++


    i am trying to alter the output so that if any of the above hours
    is free -- the user can request the first hours if it is free
    e.g as seen above 9am or the next free hour thereafter.

    ==============================================
    Code:
      if(!schedule[t])
    {//Check if booked
    
                schedule[t]=true;//Now booked
                return 1;//Success!
    }
                else return 0;//Not available...
    ==============================================

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    So you input a start time and the number of hours duration, then use a for loop to set schedule[t] for all those hours.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    2

    i don't understand

    is this what you mean



    Code:
     if(!schedule[t]){//Check if booked
               
            schedule[t]=false;//
                    return 1;
        schedule[t]=true;//Now booked
                return 1;//Success!
    }
        else return 0;//Not available.

  4. #4
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Well, you have no problem. you have no idea!
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    > is this what you mean
    Suggest some alternative input, and some alternative output of what you expect to see.
    Then post your attempt at trying to read the input and produce the output.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21