Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. // ДЛЯ ВЕРЫ И ИРИШКИ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <time.h>
  6. using namespace std;
  7.  
  8. void main()
  9. {
  10. srand(time(NULL));
  11. setlocale(LC_ALL, "rus");
  12. int arr[30];
  13. int summ = 0;
  14. bool p = false;
  15. cout << "Исходный массив: ";
  16. for (int i = 0; i < 30; i++)
  17. {
  18. arr[i] = rand() % 10000;
  19. }
  20. for (int i = 0; i < 30; i++)
  21. {
  22. if (arr[i] < 200 && arr[i]%5==0)
  23. {
  24. p = true;
  25. }
  26. }
  27. if (p == false)
  28. {
  29. arr[0] = 195;
  30. arr[1] = 150;
  31. }
  32. for (int i = 0; i < 30; i++)
  33. {
  34. cout << arr[i] << " ";
  35. }
  36. for (int i = 0; i < 30; i++)
  37. {
  38. if (arr[i] < 200 && arr[i] % 5 == 0)
  39. {
  40. summ += arr[i];
  41. }
  42. }
  43. for (int i = 0; i < 30; i++)
  44. {
  45. if (arr[i] < 200 && arr[i] % 5 == 0)
  46. {
  47. arr[i] = summ;
  48. }
  49. }
  50. cout << endl;
  51. cout << endl;
  52. cout << "Преобразованный: ";
  53. cout << endl;
  54. for (int i = 0; i < 30; i++)
  55. {
  56. cout << arr[i] << endl;
  57. }
  58. system("pause");
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement