1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
int initRoomsList(Request *R)
{
int roomSatisfying ;
char roomName[20] ;
int roomNum, capacity,wb,proj, lcd, sound, aud, vid , ac ;
int count = 0;
FILE *fp ;
fp = fopen("rooms.txt","r") ;
while(fscanf(fp,"%d %d %d %d %d %d %d %d %d %s", \
&roomNum,&capacity, &wb,&proj,&lcd,&sound,&aud,&vid,&ac,roomName) != EOF )
{
if(R->capacity > capacity )
continue ;
if(R->wb > wb )
continue ;
if(R->proj > proj)
continue ;
if(R->lcd > lcd )
continue ;
if(R->sound > sound )
continue ;
if(R->aud > aud)
continue ;
if(R->vid > vid )
continue ;
if(R->ac > ac)
continue ;
// If control is here, that means this room fulfils all conditions .
cout<<"hi "<<roomNum<<endl ;
cout<<"hello "<<&(R->roomsList)<<endl ;
[b](R->roomsList).push_back(roomNum) ;[/b]
cout<<"bye "<<&(R->roomsList)<<endl ;
count++;
}
fclose(fp) ;
if(count==0)
return 0 ;
else
return 1 ;
}
|