error C2297: '>>' : illegal, right operand has type 'void'
error C2296: '>>' : illegal, left operand has type 'float'
error C2297: '>>' : illegal, right operand has type 'void'
warning C4552: '>>' : operator has no effect; expected operator with side-effect.
i get these errors and i dont know why when input and outputing a file.
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<iomanip>
using namespace std;
void main()
{
float price,curr_total=0.0;
int itemnum, wrong=0, items;
ifstream in_stream;
ofstream in_stream1;
ifstream in_stream2;
ofstream in_stream3;
ifstream in_stream4;
ofstream in_stream5;
in_stream2.open("pricelist.txt");
in_stream4.open("receipt.txt");
in_stream.open("itemlist.txt"); // list of avaliable items
in_stream1.open("items.txt", ios::out);
// list of avaliable items and there prices.
while((! in_stream.eof()) && (! in_stream2.eof()))
// reads in_stream and in_stream2
//until the end of file
{
itemnum >> in_stream.open("itemlist.txt", ios::in);
// i need to get the items list
//which is in this file and check
// to see if item is in item list
price >> in_stream2.open("pricelist.txt", ios::in);
// opens pricelist.txt
while( in_stream2 >> itemnum >> price )
{
while((price== (price*1.00)) && (itemnum== itemnum*1)))
// if price equals a double than its a price
// itemnum = whole number.
{
cout << itemnum << ' ' << price << '\n';
// gets item number and price
itemnum++;
// saves item numbers and counts it
price++;
// saves price and counts
curr_total= price++;
cout << curr_total;
{
in_stream4.open("receipt.txt", ios::in);
// sends items and prices to receipt.txt
{
in_stream5.open("display.txt", ios::out);
in_stream5 << setw(5) << "Item number " << setw(5) << " Price " << setw(5) << " Total " << endl;
in_stream5 << " ---------------------------- " << endl;
in_stream5 << setw(5) << itemnum++ << setw(5) << price++ << setw(5) << curr_total << endl;
in_stream5 << " You have a total of " << wrong++ << " errors " << endl;
while((price!= (price*1.00)) || (itemnum != (itemnum*1)))
// if price ! = 2 double and itemnum != whole num
{
cout << " error " << endl;
wrong++;
// keeps track of errors so i can display them after program has run
}
}
}
}
}
}
in_stream.close(); // closing files.
in_stream1.close();
in_stream2.close();
in_stream3.close();
in_stream4.close();
in_stream5.close();
system("pause");
}