Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- struct avto {
- string mark;
- string cost;
- string year;
- string color;
- };
- bool record_fit_your_condition(avto record) {
- static int min_year = 2010;
- return record.year > min_year;\здесь выдает ошибку(((((((
- }
- int main()
- {
- int MAX;
- cout <<"vvedite col-vo avton";
- cin>>MAX;
- avto b[MAX];
- for (int i=0;i<MAX;++i)
- {
- cout << "Enter mark :" << endl;
- cin >> b[i].mark;
- cout << "Enter cost :" << endl;
- cin >> b[i].cost;
- cout << "Enter year :" << endl;
- cin >> b[i].year;
- cout << "Enter cvet :" << endl;
- cin >> b[i].color;
- }
- ofstream outfile;
- outfile.open("Out.txt");
- for (int i=0;i<MAX;++i)
- {
- outfile << b[i].mark << " " << b[i].cost << " " << b[i].year << " " << b[i].color << endl;
- }
- outfile.close();
- ifstream infile;
- infile.open("Out.txt");
- ofstream outfile1;
- outfile1.open("Temp.txt");
- avto record;
- for (int i=0; i<MAX; ++i) {
- infile >> record.mark >> record.cost >> record.year >> record.color;
- if (record_fit_your_condition(record))
- outfile1 << record.mark << " " << record.cost << " " << record.year << " " << record.color << endl;
- }
- infile.close();
- outfile.close();
- remove("Out.txt");
- rename("Temp.txt", "Out.txt");
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement