-
Notifications
You must be signed in to change notification settings - Fork 0
/
HOSTEL.CPP
5722 lines (4874 loc) · 184 KB
/
HOSTEL.CPP
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//REQUIRED CONSTANT DECLARATIONS
const int SINGLE = 101;
const int DOUBLE = 102;
const int SHADOW = 103;
const int NO_SHADOW = 104;
const int FRONT = 105;
const int REAR = 106;
const int TRUE = 107;
const int FALSE = 108;
const int YES = 109;
const int NO = 110;
//REQUIRED STANDARD LIBRARIES
#include <dir.h>
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h>
//REQUIRED STRUCTURE DEFINITIONS
struct member
{
char name[ 50 ];
char address[ 50 ];
char phone[ 50 ];
char qualification[ 50 ];
char room_no[ 21 ];
int sex;
int day;
int month;
int year;
} temp_member;
struct expenses
{
char item[ 21 ];
float price;
int day;
int month;
int year;
} temp_expenses;
struct bill
{
float amount;
char contributor[ 50 ];
int day;
int month;
int year;
} temp_bill;
struct room
{
char room_no[ 21 ];
int capacity;
int day;
int month;
int year;
} temp_room;
//REQUIRED GLOBAL VARIABLES
char expenses_file[ 50 ];
//REQUIRED FUNCTION PROTOTYPES
//FUNCTIONS FOR MANIPULATING MENU SYSTEM
void main_menu( void );
int reports_menu( void );
int sub_menu( int row );
//FUNCTIONS FOR DISPLAYING REPORTS
void members_report( void );
void expenses_report( void );
void bills_report( void );
void rooms_report( void );
//FUNCTIONS FOR COUNTING RECORDS
int count_member_records( void );
int count_expenses_records( void );
int count_bills_records( void );
int count_room_records( void );
//FUNCTIONS FOR FINDING RECORDS
int find_member_record( int record_no );
int find_expenses_record( int record_no );
int find_bills_record( int record_no );
int find_room_record( int record_no );
//FUNCTIONS FOR WRITING RECORDS
void write_member_record_to_file( void );
void write_expenses_record_to_file( void );
void write_bill_record_to_file( void );
void write_room_record_to_file( void );
//FUNCTIONS FOR REMOVING RECORDS
void remove_member_record( int recod_no );
void remove_expenses_record( int record_no );
void remove_bills_record( int record_no );
void remove_room_record( int record_no );
//FUNCTIONS FOR MODIFYING RECORDS
void modify_member_record( int record_no );
void modify_expenses_record( int record_no );
void modify_bills_record( int record_no );
void modify_room_record( int record_no );
//DATA TYPE CONVERSION FUNCTIONS
char * float_to_string( float value );
int string_to_float( char * string , float * value );
int string_to_int( char * string , int * value );
//FUNCTIONS FOR WRITING AND READING BACK SETTINGS
void write_settings_to_file( char * file_name );
void load_settings( void );
//DIALOG BOXES
void msgbox( char * title , char * message , int page );
int yes_no( char * message );
int add_member_record_dialog_box( int load_values );
int add_expenses_record_dialog_box( int load_values );
int add_bill_record_dialog_box( int load_values );
int add_room_record_dialog_box( int load_values );
int read_member_record_dialog_box( int * record_no );
int read_expenses_record_dialog_box( int * record_no );
int read_bills_record_dialog_box( int * record_no );
int read_room_record_dialog_box( int * record_no );
void settings_dialog_box( void );
int ask_filename_dialog_box( char * file );
//FUNCTIONS FOR WRITING REPORTS TO FILES
void write_members_report_to_file( char * file );
void write_bills_report_to_file( char * file );
void write_expenses_report_to_file( char * file );
void write_rooms_report_to_file( char * file );
//COMMON FUNCTIONS
void draw_border( int x1 , int y1 , int x2 , int y2 , int type , int fore_ground_color , int back_ground_color , int shadow , int page );
void draw_line( int type , int row , int from , int to , int fore_ground_color , int back_ground_color , int page );
void fill_screen( int x1 , int y1 , int x2 , int y2 , int color , int page );
void display_string( char *string , int color , int back_ground_color , int hot_key_color , int column, int row , int shadow , int page );
void modified_display_string( char * string );
void goto_xy( int x , int y , int page );
void dos_shell( void );
int does_room_number_exist( char * room_no );
int count_members_in_the_room( char * room_no );
char * get_date_string( int day , int month , int year );
void copy_video_page( int from ,int to );
void change_active_video_page( int to );
int find_color_attribute( int fore_ground_color , int back_ground_color );
int is_filename_valid( char * filename );
int is_chronological( date first, date second );
//FUNCTIONS FOR FINDING TOTAL AND BALANCE AMOUNTS
float find_balance_amount( void );
float find_total_amount( void );
//REQUIRED CLASS DEFINITIONS
// THE KEY CLASS ( TO READ KEY STROKES )
class key
{
private:
int ascii_code;
int scan_code;
public:
key()
{
ascii_code = scan_code = 99;
}
void read_key_stroke( void );
void set_values( int asc , int scan );
void init( void );
int get_ascii_code( void );
int get_scan_code( void );
};
void key :: set_values( int asc , int scan )
{
ascii_code = asc;
scan_code = scan;
}
void key :: init( void )
{
ascii_code = scan_code = 99;
fflush( stdin );
}
int key :: get_ascii_code( void )
{
return ( ascii_code );
}
int key :: get_scan_code( void )
{
return ( scan_code );
}
void key :: read_key_stroke( void )
{
init();
while( ! kbhit() );
ascii_code = getch();
if( ascii_code == 0 )
{
scan_code = getch();
}
}
// THE TEXTBOX CLASS
class text_box
{
private:
char text[ 50 ];
int current_size;
int current_position;
int from;
int length;
int row;
int skip;
int page;
key my_key;
public:
text_box() {}
text_box( int fr , int len , int ro , int page );
void initialize( int fr , int len , int ro , int page );
int read( void );
void draw_textbox( int color = 11 , int back_ground_color = 1 );
void left_arrow( void );
void right_arrow( void );
void back_space( void );
void del( void );
void home( void );
void end( void );
void character( void );
int got_focus( void );
void lost_focus( void );
char * get_text( void );
void set_text( char * string );
};
text_box :: text_box( int fr , int len , int ro , int page )
{
initialize( fr , len , ro , page );
}
void text_box :: initialize( int fr , int len , int ro , int pag )
{
length = len;
current_position = 0;
skip = 0;
from = fr;
row = ro;
page = pag;
current_size = 0;
strcpy( text , "" );
}
int text_box :: got_focus( void )
{
int result;
if( current_size > length )
{
current_position = length - 1;
skip = current_size - length + 1;
}
else
{
skip = 0;
current_position = current_size;
}
_setcursortype( _NORMALCURSOR );
result = read();
lost_focus();
return ( result );
}
void text_box :: lost_focus( void )
{
strupr( text );
skip = 0;
draw_textbox( 11 , 1 );
_setcursortype( _NOCURSOR );
}
char * text_box :: get_text( void )
{
if( current_size <= 49 )
{
text[ current_size ] = '\0';
}
else
{
text[ 49 ] = '\0';
}
return ( text );
}
void text_box :: set_text( char *String )
{
int len;
strcpy( text , String );
len = strlen( String );
if( len <= 50 )
{
current_size = strlen( String );
}
else
{
current_size = 50;
}
}
int text_box :: read( void )
{
int repeat_loop = 1;
while( repeat_loop )
{
draw_textbox( 15, 1 );
goto_xy( from + current_position + 1 , row , page );
my_key.read_key_stroke();
if( my_key.get_ascii_code() == 0 )
{
switch( my_key.get_scan_code() )
{
case 75: //left arrow
left_arrow();
break;
case 77: //right
right_arrow();
break;
case 71: //home key
home();
break;
case 79: //end key
end();
break;
case 83: //del key
del();
break;
case 15: //shift tab
return ( 1 );
}
}
else
{
switch( my_key.get_ascii_code() )
{
case 8://back_space
back_space();
break;
case 9://tab
return ( 2 );
case 13://enter
return ( 3 );
case 27: //esc
return ( 4 );
default:
character();
break;
}
}
}
return ( 0 );
}
void text_box :: right_arrow( void )
{
if( ( current_position == length - 1 ) && ( skip + current_position < current_size ) )
{
skip++;
}
if( ( current_position < length - 1 ) && ( skip + current_position < current_size ) )
{
current_position++;
}
}
void text_box :: left_arrow( void )
{
if( current_position == 0 && skip > 0 )
{
skip--;
}
if( current_position > 0 )
{
current_position--;
}
}
void text_box :: del( void )
{
if( current_size == 0 || skip + current_position == current_size )
{
return;
}
for(int i = skip + current_position ; i < current_size ; i++ )
{
text[ i ] = text[ i + 1 ];
}
current_size--;
if( skip > 0 )
{
skip--;
current_position++;
}
}
void text_box :: end( void )
{
if( current_size < length )
{
skip = 0;
current_position = current_size;
}
else
{
skip = current_size - length + 1;
current_position = length - 1;
}
}
void text_box :: back_space( void )
{
int l;
if( current_position == 0 )
{
return;
}
for( l = ( skip + current_position ) ; l < current_size ; l++ )
{
text[ l - 1 ] = text[ l ];
}
current_size--;
if( skip > 0 )
{
skip--;
}
else
{
current_position--;
}
}
void text_box :: character( void )
{
int i;
if( current_size >= 50 )
{
return;
}
current_size++;
for( i = current_size - 1 ; i >= ( skip + current_position ) + 1 ; i-- )
{
text[ i ] = text[ i - 1 ];
}
text[i] = my_key.get_ascii_code();
if( current_position == length - 1 )
{
skip++;
}
else
{
current_position++;
}
}
void text_box :: home( void )
{
skip = 0;
current_position = 0;
}
void text_box :: draw_textbox( int color ,int back_ground_color )
{
char far * vid_mem = ( char far * )0xB8000000L;
vid_mem += ( page * 4096 );
char far * v;
v = ( char far* ) vid_mem + 160 * ( row - 1 ) + 2 * ( from - 1 );
int i = skip;
int attrib = find_color_attribute( color , back_ground_color );
for( int j = 0 ; j < ( length + 2 ) ; j++ )
{
*v = ' ';
v++;
*v = attrib;
v++;
}
v = ( char far* ) vid_mem + 160 * ( row - 1 ) + 2 * from;
j = 0;
while( i < current_size && j < length )
{
*v = text[ i ];
v++;
*v = attrib;
i++;
v++;
j++;
}
}
//THE DATE CLASS
class Date
{
private:
int day;
int month;
int year;
text_box textboxes[3];
int tab_counter;
public:
Date() {}
int got_focus( int direction );
void initialize( int from, int row );
void initialize_textboxes( void );
void set_date( int day , int month , int year );
void reset( void );
int get_day( void );
int get_month( void );
int get_year( void );
int is_valid( void );
void display_error_message( void );
};
void Date :: initialize(int from, int row)
{
textboxes[0].initialize(from , 3 , row , 1 );
textboxes[1].initialize(from + 9 , 3 , row , 1 );
textboxes[2].initialize(from + 18 , 5 , row , 1 );
tab_counter = 0;
display_string( "DD", 0 , 7 , 4 , from + 6 , row , NO_SHADOW , 1 );
display_string( "MM", 0 , 7 , 4 , from + 15 , row , NO_SHADOW , 1 );
display_string( "YY", 0 , 7 , 4 , from + 26 , row , NO_SHADOW , 1 );
reset();
}
void Date :: set_date( int d , int m , int y )
{
day = d;
month = m;
year = y;
}
int Date :: got_focus( int direction )
{
int result;
int repeat_loop = 1;
key my_key;
tab_counter = 0;
if( direction == REAR )
{
tab_counter = 2;
}
while( repeat_loop )
{
result = textboxes[ tab_counter ].got_focus();
switch( result )
{
case 1: //Shift tab
if( is_valid() )
{
if( tab_counter == 0 )
{
result = 1;
repeat_loop = 0;
}
else
{
tab_counter--;
}
}
break;
case 2: //tab
if( is_valid() )
{
if( tab_counter == 2 )
{
result = 2;
repeat_loop = 0;
}
else
{
tab_counter++;
}
}
break;
case 3: //Enter
if( is_valid() )
{
result = 3;
repeat_loop = 0;
}
break;
case 4: //Escape
result = 4;
repeat_loop = 0;
break;
}
}
return ( result );
}
void Date :: reset( void )
{
struct date temp_date;
getdate( &temp_date );
day = temp_date.da_day;
month = temp_date.da_mon;
year = temp_date.da_year;
initialize_textboxes();
}
void Date :: initialize_textboxes( void )
{
char string[ 100 ];
itoa( day , string, 10 );
textboxes[ 0 ].set_text( string );
itoa( month , string, 10 );
textboxes[ 1 ].set_text( string );
itoa( year , string, 10 );
textboxes[ 2 ].set_text( string );
for(int i=0 ; i<=2 ; i++ )
{
textboxes[i].draw_textbox( 11 , 1 );
}
}
int Date :: get_day( void )
{
return ( day );
}
int Date :: get_month( void )
{
return ( month );
}
int Date :: get_year( void )
{
return ( year );
}
int Date :: is_valid( void )
{
int value = 0;
int value_limits[ 3 ][ 2 ] = { 1 , 31 , 1 , 12 , 1900 , 2100 };
int width_limits[ 3 ] = { 2 , 2 , 4 };
int days_in_month[ 12 ] = { 31 , 28 , 31 , 30 , 31 , 30 ,
31 , 31 , 30 , 31 , 30 , 31 };
char string[ 50 ];
strcpy( string, textboxes[ tab_counter ].get_text() );
int len = strlen( string );
if( len == 0 || len > width_limits[ tab_counter ] )
{
display_error_message();
return ( 0 );
}
for( int i = 0 ; i < len ; i++ )
{
if( string[ i ] < 48 || string[ i ] > 57 )
{
display_error_message();
return ( 0 );
}
value = ( value * 10 ) + ( string[ i ] - 48 );
}
if( value < value_limits[ tab_counter ][ 0 ] || value > value_limits[ tab_counter ][1] )
{
display_error_message();
return ( 0 );
}
else
{
switch( tab_counter )
{
case 0:
day = value;
break;
case 1:
month = value;
break;
case 2:
year = value;
break;
}
}
int leap = 0;
if( year % 4 == 0 )
{
leap = 1;
if( year % 100 == 0 )
{
if( year % 400 == 0 )
{
leap = 1;
}
else
{
leap = 0;
}
}
}
if( leap )
{
days_in_month[ 1 ] = 29;
}
if( day > days_in_month[ month - 1 ] )
{
tab_counter = 0;
display_error_message();
return ( 0 );
}
}
void Date :: display_error_message( void )
{
switch( tab_counter )
{
case 0:
msgbox( " ERROR " , " PLEASE ENTER A VALID DAY " , 2 );
break;
case 1:
msgbox( " ERROR " , " PLEASE ENTER A VALID MONTH " , 2 );
break;
case 2:
msgbox( " ERROR " , " PLEASE ENTER A VALID YEAR " , 2 );
break;
}
}
//FUNCTIONS FOR WRITING REPORTS TO FILES
void write_members_report_to_file( char * filename )
{
int record_no = 0;
char temp_string[ 50 ];
ofstream out_file;
out_file.open( filename , ios::trunc | ios::binary );
ifstream in_file;
in_file.open( "MEMBERS.DAT" , ios::in | ios::binary );
in_file.read( (char *) & temp_member , sizeof( temp_member ) );
strcpy( temp_string , "\n MEMBERS REPORT");
out_file.write( temp_string , strlen( temp_string ) );
while( in_file )
{
record_no++;
strcpy( temp_string , "\n\nRECORD NO. " );
out_file.write( temp_string , strlen( temp_string ) );
itoa( record_no , temp_string , 10 );
strcat( temp_string , temp_string );
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nNAME : " );
strcat( temp_string , temp_member.name );
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nSEX : " );
if( temp_member.sex == 0 )
{
strcat( temp_string , "MALE" );
}
else
{
strcat( temp_string , "FEMALE" );
}
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nADDRESS : " );
strcat( temp_string , temp_member.address );
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nPHONE : " );
strcat( temp_string , temp_member.phone );
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nQUALIFICATION: " );
strcat( temp_string , temp_member.qualification );
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nJOINING DATE : " );
strcat( temp_string , get_date_string( temp_member.day , temp_member.month , temp_member.year ) );
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\nROOM NO.: " );
strcat( temp_string , temp_member.room_no );
out_file.write( temp_string , strlen( temp_string ) );
in_file.read( (char *) & temp_member , sizeof( temp_member ) );
}
in_file.close();
out_file.close();
}
void write_expenses_report_to_file( char * filename )
{
int record_no = 0;
char temp_string[ 80 ];
float balance_amount = find_total_amount();
ofstream out_file;
out_file.open( filename , ios::trunc | ios::binary );
ifstream in_file;
in_file.open( expenses_file , ios::in | ios::binary );
in_file.read( (char *) & temp_expenses , sizeof( temp_expenses ) );
strcpy( temp_string , "\n EXPENSES REPORT");
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\n\nNO. ITEM NAME PRICE DATE BALANCE\n\n" );
out_file.write( temp_string , strlen( temp_string ) );
while( in_file )
{
record_no++;
itoa( record_no , temp_string , 10 );
strcat( temp_string , "." );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 5 - strlen( temp_string ) , ios::cur );
strcpy( temp_string , temp_expenses.item );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 23 - strlen( temp_string ) , ios::cur );
strcpy( temp_string , "Rs. " );
strcat( temp_string , float_to_string( temp_expenses.price ) );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 15 - strlen( temp_string ) , ios::cur );
strcpy( temp_string , get_date_string( temp_expenses.day , temp_expenses.month , temp_expenses.year ) );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 13 - strlen( temp_string ) , ios::cur );
balance_amount = balance_amount - temp_expenses.price;
strcpy( temp_string , "Rs. " );
strcat( temp_string , float_to_string( balance_amount ) );
strcat( temp_string , "\n" );
out_file.write( temp_string , strlen( temp_string ) );
in_file.read( (char *) & temp_expenses , sizeof( temp_expenses ) );
}
in_file.close();
out_file.close();
}
void write_rooms_report_to_file( char * filename )
{
int record_no = 0;
char temp_string[ 80 ];
ofstream out_file;
out_file.open( filename , ios::trunc | ios::binary );
ifstream in_file;
in_file.open( "ROOMS.DAT" , ios::in | ios::binary );
in_file.read( (char *) & temp_room , sizeof( temp_room ) );
strcpy( temp_string , "\n ROOMS REPORT");
out_file.write( temp_string , strlen( temp_string ) );
strcpy( temp_string , "\n\nNO. ROOM NO. CAPACITY FILLED DATE\n\n");
out_file.write( temp_string , strlen( temp_string ) );
while( in_file )
{
record_no++;
itoa( record_no , temp_string , 10 );
strcat( temp_string , "." );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 5 - strlen( temp_string ) , ios::cur );
strcpy( temp_string , temp_room.room_no );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 26 - strlen( temp_string ) , ios::cur );
itoa( temp_room.capacity , temp_string , 10 );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 14 - strlen( temp_string ) , ios::cur );
itoa( count_members_in_the_room( temp_room.room_no ) , temp_string , 10 );
out_file.write( temp_string , strlen( temp_string ) );
out_file.seekp( 13 - strlen( temp_string ) , ios::cur );
strcpy( temp_string , get_date_string( temp_room.day , temp_room.month , temp_room.year ) );
strcat( temp_string , "\n" );
out_file.write( temp_string , strlen( temp_string ) );
in_file.read( (char *) & temp_room , sizeof( temp_room ) );
}
in_file.close();