Advertisement
Guest User

main

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include "Header.h"
  4. using namespace std;
  5. int& countStud(istream &in)
  6. {
  7. char *str = new char[1024];
  8. int count = 0;
  9. while (!in.eof())
  10. {
  11. in.getline(str, 1024, '\n');
  12. count++;
  13. }
  14. delete str;
  15. in.clear();
  16. in.seekg(0);
  17. return count;
  18. }
  19. void main()
  20. {
  21. setlocale(LC_ALL, "rus");
  22. ifstream in1("StudBase.txt");
  23. ifstream in2("Data.txt");
  24. int count_students = countStud(in1);
  25.  
  26. cout << "Считали в класс-наследник информацию из Data.txt:" << endl;
  27. Zachetka c1(count_students);
  28. Student <Container1> student(count_students);
  29. in2 >> c1;
  30. cout << c1;
  31. int *arr = new int[count_students];
  32.  
  33. cout << "Средний балл: " << endl;
  34. arr = student.AverageMark(&c1);
  35. for (int i = 0; i < count_students; i++)
  36. cout << arr[i] << " ";
  37.  
  38. cout << endl << "Кол-во хороших оценок у каждого:" << endl;
  39. arr = student.CountGoodMarks(&c1);
  40. for (int i = 0; i < count_students; i++)
  41. cout << arr[i] << " ";
  42.  
  43. cout << endl << "Худшая оценка у каждого:" << endl;
  44. arr = student.MinMarks(&c1);
  45. for (int i = 0; i < count_students; i++)
  46. cout << arr[i] << " ";
  47.  
  48. cout <<endl<< "Считали в класс-шаблон Student информацию из StudBase.txt:";
  49. in1 >> student;
  50. cout << endl <<" "<< student;
  51.  
  52.  
  53. Student <Container3> student2(count_students);
  54. student2.Sum(student, c1);
  55. cout << endl << "Результат!!!!!!!!!!!! :" << endl;
  56. cout <<" "<< student2;
  57.  
  58.  
  59. cout << endl;
  60. system("pause");
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement