For a big project for school I have to make an airline reservation simulator but I have run into a problem. I want to save the the flight code and its location in a binary file so that I can obtain a code according to the location but this happens:
The current output
expected output
Here is the source class
Code:class file { private: char code[8]; char from[20]; public: void input(); void show(); char *getn() { return code; } };file fileobj; void file::input() { clrscr(); cout<<"Enter Code+ no: "; gets(code); int A=strlen(code); if(A==6) strcat(code," "); else strcat(code," "); cout<<"Enter Location: "; gets(from); int a=20-strlen(from); for(int i=0;i<a;i++) strcat(from," "); } void file::show() { cout<<"Code: ";puts(code); cout<<"\t\tLocation: ";puts(from); }