1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string.h>
using namespace std;
void readatof(int x[], int y[], int n);
struct door
{
int length[10], width[10];
};
int main()
{
int length[]={10,20,30,40,50,60,70,80,90,100};
int width[]={5,10,15,20,25,30,35,40,45,50};
readatof(length, width, 10);
fstream arrayFile;
arrayFile.open("C://Users//Esmeralda//Desktop//arrays.txt",ios::in);
if (arrayFile.fail())
{
cout << "Error openning file" << endl;
exit(0);
}
door tab[10];
int length, width;
int i=0;
arrayFile >> length >> width; //error says no operators match these operands
while (!arrayFile.eof())
{
tab[i].length=length; //error: expression must be a modifiable lvalue
tab[i].width=width; //error: expression must be a modifiable lvalue
i++;
door >> length >> width; //error says no operators match these operands
}
system("pause");
return 0;
}
void readatof(int x[], int y[], int n)
{
fstream arrayFile;
arrayFile.open("C://Users//Esmeralda//Desktop//arrays.txt",ios::out);
if (arrayFile.fail()){exit(0);}
for (int i=0;i<n;i++)
{
arrayFile << x[i] << "\t" << y[i] << endl;
}
arrayFile.close();
}
|