Advertisement
Guest User

Untitled

a guest
May 30th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. #include<fstream>
  2. #include <conio.h>
  3. #include<iostream>
  4. #include <stdio.h>
  5. #include<iomanip>
  6. void menushka ();
  7. void Consl_vyvod_info ();
  8. struct gruppa;
  9. struct student;
  10. gruppa *Top, *new_gr, *actual_gr;
  11. student *top_st, *new_st, *actual_st;
  12. int ns,ng;
  13. using namespace std;
  14. struct gruppa
  15. {
  16. int Nomer_Gruppy;
  17. int kolichestvo_studentov;
  18. gruppa *next;
  19. student *st;
  20. };
  21. struct student
  22. {
  23. char FIO[50];
  24. int nomer_studenta;
  25. int sessiy[5];
  26. float stependiy;
  27. char bydzhet_kontrakt[2];
  28. student *next1;
  29. student *t;
  30. };
  31. void menushka ()
  32. {
  33. ifstream strm("./menu.txt");
  34. char ss[255] = {0};
  35. while(true)
  36. {
  37. strm.getline(ss, 255);
  38. if (strm.eof()) break;
  39. cout << ss << "\n";
  40. }
  41.  
  42. }
  43. void Consl_Vvod_info () //Консольный Ввод информации
  44. {
  45. Top=new gruppa;
  46. actual_gr=Top;
  47. cout<<"Введите номер группы"<<endl;
  48. cin>>actual_gr->Nomer_Gruppy;
  49. while(true)
  50. {
  51. top_st = new student;
  52. actual_st = top_st;
  53. actual_gr->st=actual_st;
  54. cout<<"Введите номер студента"<<endl;
  55. cin>>actual_st->nomer_studenta;
  56. cout<<"Введите ФИО студента"<<endl;
  57. cin>>actual_st->FIO;
  58. cout<<"Введите 5 оценок за сессию"<<endl;
  59. for(int i=0;i<5;i++)
  60. cin>>actual_st->sessiy[i];
  61. cout<<"Введите размер степендии"<<endl;
  62. cin>>actual_st->stependiy;
  63. cout<< "Бюджетник(B) или контрактник(K)"<<endl;
  64. cin>>actual_st->bydzhet_kontrakt;
  65. actual_gr->kolichestvo_studentov=1;
  66. while(true)
  67. {
  68. cout<<"Введите номер студента"<<endl;
  69. cin>>ns;
  70. if (ns==0)
  71. {
  72. actual_st->next1 = NULL;
  73. break;
  74. }
  75. new_st = new student;
  76. actual_st->next1 = new_st;
  77. actual_st = new_st;
  78. actual_st->nomer_studenta=ns;
  79. cout<<"Введите ФИО студента";
  80. cin>>actual_st->FIO;
  81. cout<<"Введите 5 оценок за сессию"<<endl;
  82. for(int i=0;i<5;i++)
  83. cin>>actual_st->sessiy[i];
  84. cout<<"Введите размер степендии"<<endl;
  85. cin>>actual_st->stependiy;
  86. cout<< "Бюджетник(B) или контрактник(K)"<<endl;
  87. cin>>actual_st->bydzhet_kontrakt;
  88. actual_gr->kolichestvo_studentov++;
  89. }
  90. cout<<"Введите номер группы"<<endl;
  91. cin>>ng;
  92. if (ng==0)
  93. {
  94. actual_gr->next = NULL;
  95. break;
  96. }
  97. new_gr=new gruppa;
  98. actual_gr->next=new_gr;
  99. actual_gr=new_gr;
  100. actual_gr->Nomer_Gruppy=ng;
  101. }
  102. }
  103. void Consl_vyvod_info () //Консольный вывод Информации
  104. {
  105. actual_gr=Top;
  106. while (actual_gr)
  107. {
  108. cout<<"Номер группы__Количество студентов"<<endl;
  109. cout<<actual_gr->Nomer_Gruppy<<" "<<actual_gr->kolichestvo_studentov<<endl;
  110. cout<<"Фио__Оценки за сессию__Размер степендии__Бюджет/Контракт"<<endl;
  111. while (actual_gr->st)
  112. {
  113. cout<<actual_gr->st->FIO<<" ";
  114. for(int i=0;i<5;i++) cout<<actual_gr->st->sessiy[i]<<" ";
  115. cout<<actual_gr->st->stependiy<<" "<<actual_gr->st->bydzhet_kontrakt<<endl;
  116. new_st=actual_gr->st->next1;
  117. actual_gr->st=new_st;
  118. }
  119. actual_gr=actual_gr->next;
  120. }
  121. }
  122. int main ()
  123. {
  124. setlocale (LC_ALL, "RUS");
  125. int input;
  126. while (1)
  127. {
  128. menushka();
  129. cin>>input;
  130. switch (input)
  131. {
  132. case 1:
  133. Consl_Vvod_info ();
  134. system("cls");
  135. break;
  136. case 2:
  137. Consl_vyvod_info ();
  138. break;
  139. }
  140. }
  141. cin.get();
  142. return 0;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement