Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <fstream>
  4. #include <string>
  5. using namespace std;
  6.  
  7. struct avto {
  8. string mark;
  9. string cost;
  10. string year;
  11. string color;
  12. };
  13.  
  14. bool record_fit_your_condition(avto record) {
  15. static int min_year = 2010;
  16. return record.year > min_year;\здесь выдает ошибку(((((((
  17. }
  18.  
  19. int main()
  20. {
  21. int MAX;
  22. cout <<"vvedite col-vo avton";
  23. cin>>MAX;
  24. avto b[MAX];
  25. for (int i=0;i<MAX;++i)
  26. {
  27. cout << "Enter mark :" << endl;
  28. cin >> b[i].mark;
  29. cout << "Enter cost :" << endl;
  30. cin >> b[i].cost;
  31. cout << "Enter year :" << endl;
  32. cin >> b[i].year;
  33. cout << "Enter cvet :" << endl;
  34. cin >> b[i].color;
  35. }
  36.  
  37. ofstream outfile;
  38. outfile.open("Out.txt");
  39. for (int i=0;i<MAX;++i)
  40. {
  41. outfile << b[i].mark << " " << b[i].cost << " " << b[i].year << " " << b[i].color << endl;
  42. }
  43. outfile.close();
  44.  
  45. ifstream infile;
  46. infile.open("Out.txt");
  47. ofstream outfile1;
  48. outfile1.open("Temp.txt");
  49. avto record;
  50. for (int i=0; i<MAX; ++i) {
  51. infile >> record.mark >> record.cost >> record.year >> record.color;
  52. if (record_fit_your_condition(record))
  53. outfile1 << record.mark << " " << record.cost << " " << record.year << " " << record.color << endl;
  54. }
  55. infile.close();
  56. outfile.close();
  57. remove("Out.txt");
  58. rename("Temp.txt", "Out.txt");
  59. system("pause");
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement