• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

C++ Struct Question

#1
my first Struct:

Code:
struct menuType		//struct definition
{
	string itemName;	//name of item
	double itemPrice;	//price of item
};

string getMenu()
{
	ifstream menuList;
	menuList.open("menuList.txt");
	if (menuList.is_open())
	{
		while (! menuList.eof())
		{
			cin.getline (menuInfo.itemName,menuInfo.itemPrice);
		}
	}
};

what am i doing wrong ?? :(
 
#3
i was trying to open a file, read it, and then have each line stored into alternating variables.

the first line would be itemName, then itemPrice. until the end of the file.

thanks for the link.
 

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies