ikram002p's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
12 (0.02 per day)
Joined:
27-June 12
Profile Views:
7,754
Last Active:
User is offline Jul 21 2012 12:11 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   ikram002p allot of exams VS my brother wedding

Posts I've Made

  1. In Topic: Intro new Programmer

    Posted 27 Jun 2012

    wlcome :^:
  2. In Topic: Hello everyone!

    Posted 27 Jun 2012

    wlcome :genius:
    I have the same situation as you so dond worry :)
  3. In Topic: for loops problem

    Posted 27 Jun 2012

    View Postjimblumberg, on 27 June 2012 - 01:01 PM, said:

    You really need to find an indentation style you like and use it consistently. Your code as presented is almost unreadable.

    You need to re-post correctly formatted code or you will get few if any people that will try to read your code.


    Jim

    thanks~ am sure that I will like it .

    View Postsepp2k, on 27 June 2012 - 01:02 PM, said:

    Go to your reserved function and let your editor indent it properly. Once you do that, it will look something like this:

    int  reserved()
    {
    
        for (int k=0;k<m;k++)
            if (reserve[k].id==0);
        {
            reserve[k].id++;
            return reserve[k].id;
        }
        // ...
    
    


    Notice how the opening brace after the if is indented to the left of the if? That's because it's not connected to the if. The if is followed by a semicolon, so it has no body.

    The opening brace opens a local block that is outside of the if and more importantly outside of the for-loop. And since it's outside of the for loop k is not in scope.

    PS: In the future you really should mention the line number that you get the given error or warning on (plus the complete warning/error message). And properly indent your code, so it's easier to read and you avoid mistakes like this in the first place.

    I got it ,and thanks~ for the PS I will do it next time
  4. In Topic: am beginner to programming

    Posted 27 Jun 2012

    thanks~ :innocent:
  5. In Topic: for loops problem

    Posted 27 Jun 2012

    its really complecated example and unfinished code but here its
    #include<iostream.h>
    class date;
    class Reservation;
    class Rooms;
    class Hotel;
    class date{
    int day;
    int month;
    int year;
    public:
    date()
    { day=30;
     month=6;
     year=2012;}
    void defultset()
    { day=30;
     month=6;
     year=2012;}
    void set()
    { cin>>day>>month>>year;}
    int getday()
    {return day;}
    int getmonth()
    {return month;}
    int getyear()
    {return year;}
    };
    class Reservation{
    int id;
    date Date;
    int periodDay;
     //Rooms state;
    int RoomID;
     //Rooms roomID; //need to be defult & set
    public :
    friend Rooms;
    friend Hotel;
     Reservation()
     { id =0;
     Date.defultset();
     cout<<"please Enter period day\n";
     cin>> periodDay;cout<<"\n";
     // RoomID=state.id;
    
     }
      void set()
     { id =0;
     Date.defultset();
     cout<<"please Enter period day\n";
     cin>> periodDay;cout<<"\n";
     // RoomID=state.id;
    
     }
     void setid(int k){id=k;}
    
    
    };
    class Rooms{
    int id;
    int floor;
    float price;
    Reservation state;
    int reserved;
    public:
    Rooms(){
    id=0;
    floor=3;
    price=150.05;
    reserved= ( state.id >0);
    }
    void set(){
    id=0;
    floor=3;
    price=150.05;
    reserved= ( state.id >0); }
    
    friend Reservation;
    friend Hotel;
    };
    class Hotel{
    int  m;
    int id;
    int floors;
    Reservation * reserve;
    Rooms * room;
    
    public :
    friend Rooms;
    friend Reservation;
    Hotel(  ){
    
    m=100;
    id=501;
    floors=7;
    room = new Rooms[m];
    reserve = new Reservation[m] ;
    //for (int i=0;i<m;i++)
    }
    void set(  ){
    
    m=100;
    id=501;
    floors=7;
    room = new Rooms[m];
    //for (int i=0;i<m;i++) // warning but I dont know why
    //room[i].set();
    }
     int  reserved()
     {
    
    for (int k=0;k<m;k++)
    if (reserve[k].id==0);
    {
    reserve[k].id++;
    return reserve[k].id;
    }
    cout<<"sorry there is no empty rooms ";
    return 0;}
    void resevedRoom()
    {int g;
    for(int k=0;k<m;k++)
    if (reserve[k].id!=0)
    g++;
    cout<<"/n reseved rooms = "<<g;
    cout<<"/n";
    }
    
    void emptyRoom()
    {int g;
    for(int k=0;k<m;k++)
    if (reserve[k].id==0)
    g++;
    cout<<"/n Empty rooms = "<<g;
    cout<<"/n";
    }
    
    Rooms search(int ID)
    {
    for (int i=0;i<m;i++)
    if (room[i].id==ID)
    {
    cout<<"the price is : "<<room[i].price;
    cout<<"the floor is : "<<room[i].floor;
    if( room[i].reserved==0)
    cout<<"the room is reserved.\n";
    else
    cout<<"the room is not reserved.\n";
    
    return room[i]; }
    return room[0];
    }
    void endReservation( )
    {
    for (int i=0;i<m;i++)
    if (reserve[i].id==0)
    reserve[i].id=101;}
    
    };
    void main()
    {
    
    
    }
    
    
    

My Information

Member Title:
New D.I.C Head
Age:
21 years old
Birthday:
August 2, 1992
Gender:

Contact Information

E-mail:
Click here to e-mail me

Comments

ikram002p has no profile comments yet. Why not say hello?