ikram002p's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 12 (0.04 per day)
- Joined:
- 27-June 12
- Profile Views:
- 3,014
- Last Active:
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
-
Michael26 
05 May 2013 - 07:06 -
h4nnib4l 
02 Nov 2012 - 09:12 -
chili5 
29 Jun 2012 - 09:55 -
AhmerjavedC++ 
27 Jun 2012 - 20:15 -
Kilorn 
27 Jun 2012 - 19:06 -
modi123_1 
27 Jun 2012 - 12:18 -
Curtis Rutland 
27 Jun 2012 - 11:32 -
naasir123 
27 Jun 2012 - 10:47 -
Beweren 
27 Jun 2012 - 09:20 -
sepp2k 
27 Jun 2012 - 05:45
Posts I've Made
-
In Topic: Intro new Programmer
Posted 27 Jun 2012
wlcome
-
In Topic: Hello everyone!
Posted 27 Jun 2012
wlcome
I have the same situation as you so dond worry
-
In Topic: for loops problem
Posted 27 Jun 2012
jimblumberg, 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 .
sepp2k, 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 -
In Topic: am beginner to programming
Posted 27 Jun 2012
thanks~
-
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:
- 20 years old
- Birthday:
- August 2, 1992
- Gender:
-
Contact Information
- E-mail:
- Click here to e-mail me
Friends
-

realNoName
-

bymp
-

thava
-

Martyr2
-

no2pencil
-

MitkOK
-

Bench
-

Shadow 1.2
-

captainham...
-

fsloke
-

Craig328
-

gabehabe
-

Locke
-

modi123_1
-

gbertoli3
-

pemcconnell
-

JackOfAllT...
-

sudznwicks
-

oha055
-

#define
-

ladyinblack
-

Michael26
-

Elcric
-

Aphex19
-

BrainCode
-

jimblumberg
-

DarenR
-

creativeco...
-

Kilorn
-

Dormilich
-

Curtis Rut...
-

mccabec123
-

arvindthakur
-

sepp2k
-

stackoverflow
-

Beweren
-

rpgmaker
-

axnjxn
-

snesnerd
-

alexsmart12
-

Gazuu
-

CoryMore
-

marwa5800
-

viktor.sla...
-

michdraft
-

rkbmach
-

StormKat33
-

Szyuzaki
-

pletcherhql
-

Jackponting
Showing 50 random friends of 51 (View all)
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
ikram002p has no profile comments yet. Why not say hello?