-
-
Save sheki/1273374 to your computer and use it in GitHub Desktop.
Meghana Project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream.h> | |
| #include<fstream.h> | |
| #include<string.h> | |
| #include<stdio.h> | |
| struct details | |
| { | |
| char *category; | |
| char *name; | |
| char *phone; | |
| char *address; | |
| //char area[100]; | |
| char *food_type; | |
| char *timings; | |
| int rating; | |
| int code; | |
| char *food_code; | |
| }; | |
| int main() | |
| { | |
| ofstream fs("Restaurants1.txt", ios::app); | |
| details arr; | |
| int i=0; | |
| char ch; | |
| do | |
| { | |
| cout<<"Enter name of restaurant"<<i+1<<": "; | |
| fflush(stdin); | |
| gets(arr.name); | |
| cout<<"Enter Category: "; | |
| fflush(stdin); | |
| gets(arr.category); | |
| cout<<"Enter Phone number: "; | |
| fflush(stdin); | |
| gets(arr.phone); | |
| cout<<"Enter address: "; | |
| fflush(stdin); | |
| gets(arr.address); | |
| cout<<"Enter food type: "; | |
| fflush(stdin); | |
| gets(arr.food_type); | |
| cout<<"Enter timings: "; | |
| fflush(stdin); | |
| gets(arr.timings); | |
| cout<<"Enter rating: "; | |
| cin>>arr.rating; | |
| cout<<endl; | |
| cout<<"Enter code: "; | |
| cin>>arr.code; | |
| cout<<endl; | |
| fs.write((char*)&arr, sizeof(details)); | |
| i++; | |
| cout<<"Want to add more??"<<endl; | |
| cin>>ch; | |
| }while(ch=='y' || ch=='Y'); | |
| fs.close(); | |
| system("pause"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment