Im doing Structured Data i have it down for the

most part but there is just one error that i have. :( Keep in mind that im adding to a prior lab that i had to do


//glenda Hayes
//lab9
//5-3-2012
// this programs acts like a cash register would.
#include <iostream>
#include <fstream>
using namespace std;
struct stock
{
int ItemNumber ;//the Number that the computer has for the item
char ItemName;//what the item is
double ItemPrice ;//how much the item is
};

int main()
{
stock receipt;
int ItemNumber;
char ItemName;
double ItemPrice;

ifstream inFile ("stock");
const int size=20;
char stock[size];
inFile.open ("stock.txt");
inFile>>stock;
cout<<stock<<endl;
ofstream outFile;
char Receipt =50;

outFile.open("Receipt.txt");//the receipt for the costumer
int s;
for(s=1; s<=4; s+1)
{inFile>>ItemName;
inFile;
inFile;
cout<<ItemName<<endl;
}
float total;
while(ItemName!= 0)
{
cout<<"please give me the Item Name. "<<endl;
cin>>getline(stock.ItemName, stock);
cout<<receipt.ItemNumber<<endl;
cout<<receipt.ItemName<<endl;
cout<<receipt.ItemPrice<<endl;
}
while(ItemName = 0)
cout<<"We do not have that item. "<<endl;

outFile<< "The total is "<<total;






outFile<<ItemName;
outFile<<ItemPrice;
outFile<<ItemNumber;
cout<<"name"<<"/t/t"<<"price"<<"/t/t"<<"item number "<<endl;



outFile.close();
inFile.close();

system("pause");
return 0;
}
43: error: request for member `ItemName' in `stock', which is of non-class type `char[20]'

plz help.
Topic archived. No new replies allowed.