#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//menu struct
struct MenuType
{
//declare the name of the resaurants in the struct
string name;
//declare the telephone number of the resaurants in the struct
string telNum;
//declare the menu items of the resaurants in the struct
string menuItems;
}
//main funcion of the code
int main ()
{
//menu array declaration
MenuType restaurantArray[3];
//declare the text in file
ifstream inFile;
//open the text in file
inFile.open("menu.txt");
//read the resaurant name into the code for text in file
getline(inFile,MenuType.name);
//read the resaurant telephone number into the code for text in file
inFile >> MenuType.telNum;
//read the resaurant menu items into the code for text in file
inFile >> MenuType.menuItem;
//output the restaurant name to screen
cout << MenuType.name << endl;
//output the restaurant telephone number to screen
cout << MenuType.telNum << endl;
//output the restaurant menu item to screen
cout << MenuType.menuItem << endl;
//not sure what to do here as far as sorting in alphabetical order or putting the struct in 3 parallel arrays
system ("PAUSE");
return 0;
}
This post has been edited by niece: 05 February 2010 - 09:31 AM

New Topic/Question
Reply




MultiQuote






|