Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.81 KB | None | 0 0
  1. //Билет №3
  2.  
  3. //int main()
  4. //{
  5. // int fir, sec;
  6. // cout << "Enter your numbers." << endl;
  7. // cin >> fir;
  8. // cin >> sec;
  9. // if (fir > sec) {
  10. // cout << "The largest number is " << fir << endl;
  11. // }
  12. // else {
  13. // cout << "The largest number is " << sec << endl;
  14. // }
  15. // system("pause");
  16. // return 0;
  17. //}
  18.  
  19. //int main()
  20. //{
  21. // srand(time(0));
  22. // int prod, max = 0, k = 13;
  23. // int *arr = new int[k];
  24. // for (int i = 0; i < k; i++)
  25. // arr[i] = 13 + rand() % 987 + 1;
  26. // cout << "The array: ";
  27. // for (int i = 0; i < 12; i++)
  28. // cout << arr[i] << ' ';
  29. // cout << endl;
  30. // for (int i = 0; i < k; i++) {
  31. // prod = arr[i] * arr[i + 1];
  32. // if (prod > max)
  33. // max = prod;
  34. // }
  35. // cout << "Max product is " << max << endl;
  36. // delete[] arr;
  37. // system("pause");
  38. // return 0;
  39. //}
  40.  
  41. //int main()
  42. //{
  43. // srand(time(0));
  44. // int k = 3;
  45. // int *arr = new int[k];
  46. // arr[0] = rand() % 100;
  47. // arr[1] = arr[0];
  48. // arr[2] = arr[0];
  49. // cout << "The array: ";
  50. // for (int i = 0; i < k; i++)
  51. // cout << arr[i] << ' ';
  52. // cout << endl;
  53. // delete[] arr;
  54. // system("pause");
  55. // return 0;
  56. //}
  57.  
  58.  
  59.  
  60. // Экзамен. билеты.cpp: определяет точку входа для консольного приложения.
  61. //
  62.  
  63. #include "stdafx.h"
  64. #include <iostream>
  65. #include <vector>
  66. #include <ctime>
  67. #include <cstdlib>
  68. #include <fstream>
  69. using namespace std;
  70.  
  71. //Билет №9
  72.  
  73.  
  74. //Дано четырехзначное число. Поменяйте местами наименьшую и наибольшую цифры.
  75. //int main()
  76. //{
  77. // int min = 9, max = 0, num, k = 4, a = 1000, n, x;
  78. // cout << "Enter your number:" << endl;
  79. // cin >> num;
  80. // if (num < 1000 || num > 9999) {
  81. // cout << "Try again:" << endl;
  82. // cin >> num;
  83. // }
  84. // int *arr = new int[k];
  85. // for (int i = 0; i < k; i++) {
  86. // arr[i] = num / a;
  87. // num = num % a;
  88. // a = a / 10;
  89. // }
  90. // for (int i = 0; i < k; i++) {
  91. // if (arr[i] > max)
  92. // max = arr[i];
  93. // if (arr[i] < min)
  94. // min = arr[i];
  95. // }
  96. // for (int i = 0; i < k; i++) {
  97. // if (arr[i] == max)
  98. // n = i;
  99. // if (arr[i] == min)
  100. // x = i;
  101. // }
  102. // arr[n] = min;
  103. // arr[x] = max;
  104. // cout << "The new number:" << endl;
  105. // for (int i = 0; i < k; i++)
  106. // cout << arr[i];
  107. // cout << endl;
  108. // delete[] arr;
  109. // system("pause");
  110. // return 0;
  111. //}
  112.  
  113. //// Дано число k. Определите, существует ли такое число n, что 1+2+3+..+n=k.
  114. //int main()
  115. //{
  116. // int k, n, m = 0, a = 1;
  117. // cout << "Enter your number:" << endl;
  118. // cin >> k;
  119. // while (m < k) {
  120. // m = m + a;
  121. // a += 1;
  122. // }
  123. // if (m == k)
  124. // cout << "The number n is " << a - 1 << endl;
  125. // else
  126. // cout << "The number n doesn't exist" << endl;
  127. // system("pause");
  128. // return 0;
  129. //}
  130.  
  131. // Найдите сумму четных чисел массива.
  132. //int main()
  133. //{
  134. // srand(time(0));
  135. // int sum = 0, k;
  136. // cout << "Enter the size of the array: ";
  137. // cin >> k;
  138. // int *arr = new int[k];
  139. // for (int i = 0; i < k; i++)
  140. // arr[i] = rand() % 100 + 1;
  141. // cout << "The array: ";
  142. // for (int i = 0; i < k; i++)
  143. // cout << arr[i] << ' ';
  144. // cout << endl;
  145. // for (int i = 0; i < k; i++) {
  146. // if (arr[i] % 2 == 0)
  147. // sum = sum + arr[i];
  148. // }
  149. // cout << "Sum of odd numbers: " << sum << endl;
  150. // delete[] arr;
  151. // system("pause");
  152. // return 0;
  153. //}
  154.  
  155.  
  156. //Билет №5
  157.  
  158. //// Написать рекурсивную функцию для расчета степени n вещественного числа a (n - натуральное число).
  159. //int pow(int a, int n) {
  160. // if (n == 1) return a;
  161. // int prpow = pow(a, n - 1);
  162. // return a * prpow;
  163. //}
  164. //
  165. //int main()
  166. //{
  167. // int b, k, c = -0;
  168. // cout << "Enter the number: ";
  169. // cin >> b;
  170. // cout << "Enter the power: ";
  171. // cin >> k;
  172. // while (k > 0) {
  173. // k -= 1;
  174. // c += 1;
  175. // cout << pow(b, c) << " ";
  176. // }
  177. // cout << endl;
  178. // system("pause");
  179. // return 0;
  180. //}
  181.  
  182. //// Составить список учебной группы. Вывод ФИО всех студентов, у которых все оценки отлично.
  183. //#include "stdafx.h"
  184. //#include <iostream>
  185. //#include <string>
  186. //using namespace std;
  187. //struct date
  188. //{
  189. // int day, month, year;
  190. //};
  191. //struct rec_book
  192. //{
  193. // int mark; //оценка
  194. // string lesson;
  195. // string teacher;
  196. // date ekz_day;
  197. //};
  198. //struct student
  199. //{
  200. // string name;
  201. // date b_day;
  202. // rec_book book[3];
  203. //};
  204. //
  205. //
  206. //
  207. //int main()
  208. //{
  209. // student studs[5];
  210. // studs[0].name = "John Warner";
  211. // studs[0].b_day.day = 23;
  212. // studs[0].b_day.month = 12;
  213. // studs[0].b_day.year = 1999;
  214. // studs[0].book[0].mark = 2;
  215. // studs[0].book[0].lesson = "Physics: ";
  216. // studs[0].book[0].teacher = "Sterlyadkin V.V.";
  217. // studs[0].book[0].ekz_day.day = 27;
  218. // studs[0].book[0].ekz_day.month = 6;
  219. // studs[0].book[0].ekz_day.year = 2018;
  220. // studs[0].book[1].mark = 4;
  221. // studs[0].book[1].lesson = "Algebra and geometry:";
  222. // studs[0].book[1].teacher = "Svyatova E.A. ";
  223. // studs[0].book[1].ekz_day.day = 18;
  224. // studs[0].book[1].ekz_day.month = 6;
  225. // studs[0].book[1].ekz_day.year = 2018;
  226. // studs[0].book[2].mark = 4;
  227. // studs[0].book[2].lesson = "Programming: ";
  228. // studs[0].book[2].teacher = "Sachkov V.E. ";
  229. // studs[0].book[2].ekz_day.day = 23;
  230. // studs[0].book[2].ekz_day.month = 6;
  231. // studs[0].book[2].ekz_day.year = 2018;
  232. //
  233. // studs[1].name = "Nickolas Shelton";
  234. // studs[1].b_day.day = 3;
  235. // studs[1].b_day.month = 8;
  236. // studs[1].b_day.year = 1998;
  237. // studs[1].book[0].mark = 4;
  238. // studs[1].book[0].lesson = "Physics: ";
  239. // studs[1].book[0].teacher = "Sterlyadkin V.V.";
  240. // studs[1].book[0].ekz_day.day = 27;
  241. // studs[1].book[0].ekz_day.month = 6;
  242. // studs[1].book[0].ekz_day.year = 2018;
  243. // studs[1].book[1].mark = 3;
  244. // studs[1].book[1].lesson = "Algebra and geometry:";
  245. // studs[1].book[1].teacher = "Svyatova E.A. ";
  246. // studs[1].book[1].ekz_day.day = 18;
  247. // studs[1].book[1].ekz_day.month = 6;
  248. // studs[1].book[1].ekz_day.year = 2018;
  249. // studs[1].book[2].mark = 5;
  250. // studs[1].book[2].lesson = "Programming: ";
  251. // studs[1].book[2].teacher = "Sachkov V.E. ";
  252. // studs[1].book[2].ekz_day.day = 23;
  253. // studs[1].book[2].ekz_day.month = 6;
  254. // studs[1].book[2].ekz_day.year = 2018;
  255. //
  256. // studs[2].name = "Kathryn Campbell";
  257. // studs[2].b_day.day = 1;
  258. // studs[2].b_day.month = 1;
  259. // studs[2].b_day.year = 2000;
  260. // studs[2].book[0].mark = 5;
  261. // studs[2].book[0].lesson = "Physics: ";
  262. // studs[2].book[0].teacher = "Sterlyadkin V.V.";
  263. // studs[2].book[0].ekz_day.day = 27;
  264. // studs[2].book[0].ekz_day.month = 7;
  265. // studs[2].book[0].ekz_day.year = 2018;
  266. // studs[2].book[1].mark = 4;
  267. // studs[2].book[1].lesson = "Algebra and geometry:";
  268. // studs[2].book[1].teacher = "Svyatova E.A. ";
  269. // studs[2].book[1].ekz_day.day = 18;
  270. // studs[2].book[1].ekz_day.month = 6;
  271. // studs[2].book[1].ekz_day.year = 2018;
  272. // studs[2].book[2].mark = 5;
  273. // studs[2].book[2].lesson = "Programming: ";
  274. // studs[2].book[2].teacher = "Sachkov V.E. ";
  275. // studs[2].book[2].ekz_day.day = 23;
  276. // studs[2].book[2].ekz_day.month = 6;
  277. // studs[2].book[2].ekz_day.year = 2018;
  278. //
  279. // studs[3].name = "Walter Mills";
  280. // studs[3].b_day.day = 23;
  281. // studs[3].b_day.month = 2;
  282. // studs[3].b_day.year = 2000;
  283. // studs[3].book[0].mark = 5;
  284. // studs[3].book[0].lesson = "Physics: ";
  285. // studs[3].book[0].teacher = "Sterlyadkin V.V.";
  286. // studs[3].book[0].ekz_day.day = 27;
  287. // studs[3].book[0].ekz_day.month = 6;
  288. // studs[3].book[0].ekz_day.year = 2018;
  289. // studs[3].book[1].mark = 4;
  290. // studs[3].book[1].lesson = "Algebra and geometry:";
  291. // studs[3].book[1].teacher = "Svyatova E.A. ";
  292. // studs[3].book[1].ekz_day.day = 18;
  293. // studs[3].book[1].ekz_day.month = 6;
  294. // studs[3].book[1].ekz_day.year = 2018;
  295. // studs[3].book[2].mark = 4;
  296. // studs[3].book[2].lesson = "Programming: ";
  297. // studs[3].book[2].teacher = "Sachkov V.E. ";
  298. // studs[3].book[2].ekz_day.day = 23;
  299. // studs[3].book[2].ekz_day.month = 6;
  300. // studs[3].book[2].ekz_day.year = 2018;
  301. //
  302. // studs[4].name = "Steven Campbell";
  303. // studs[4].b_day.day = 15;
  304. // studs[4].b_day.month = 8;
  305. // studs[4].b_day.year = 2000;
  306. // studs[4].book[0].mark = 5;
  307. // studs[4].book[0].lesson = "Physics: ";
  308. // studs[4].book[0].teacher = "Sterlyadkin V.V.";
  309. // studs[4].book[0].ekz_day.day = 27;
  310. // studs[4].book[0].ekz_day.month = 7;
  311. // studs[4].book[0].ekz_day.year = 2018;
  312. // studs[4].book[1].mark = 5;
  313. // studs[4].book[1].lesson = "Algebra and geometry:";
  314. // studs[4].book[1].teacher = "Svyatova E.A. ";
  315. // studs[4].book[1].ekz_day.day = 18;
  316. // studs[4].book[1].ekz_day.month = 6;
  317. // studs[4].book[1].ekz_day.year = 2018;
  318. // studs[4].book[2].mark = 5;
  319. // studs[4].book[2].lesson = "Programming: ";
  320. // studs[4].book[2].teacher = "Sachkov V.E. ";
  321. // studs[4].book[2].ekz_day.day = 23;
  322. // studs[4].book[2].ekz_day.month = 6;
  323. // studs[4].book[2].ekz_day.year = 2018;
  324. //
  325. // for (int i = 0; i < 5; i++)
  326. // {
  327. // cout << "The student #" << i+1 << ": \n";
  328. // cout << studs[i].name << ", birthday: " << studs[i].b_day.day << "." << studs[i].b_day.month << "." << studs[i].b_day.year << endl;
  329. // cout << "Progress of this student: \n";
  330. // for (int k = 0; k < 3; k++)
  331. // {
  332. // cout << studs[i].book[k].lesson << " mark " << studs[i].book[k].mark << ", teacher " << studs[i].book[k].teacher << " exam date " << studs[i].book[k].ekz_day.day << "." << studs[i].book[k].ekz_day.month << "." << studs[i].book[k].ekz_day.year << endl;
  333. // }
  334. // cout << endl;
  335. // }
  336. // cout << endl;
  337. // cout << "Honors students:" << endl;
  338. // for (int i = 0; i < 5; i++)
  339. // {
  340. // if ((studs[i].book[0].mark >= 5) && (studs[i].book[1].mark >= 5) && (studs[i].book[2].mark >= 5))
  341. // {
  342. // cout << studs[i].name << endl;
  343. // }
  344. // };
  345. // cout << endl;
  346. // system("pause");
  347. // return 0;
  348. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement