ElenaMednikova

Untitled

Sep 30th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. 2.1
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.  
  7. const long minutes = 60;
  8. const long hours = 60*minutes;
  9. const long days = 24*hours;
  10.  
  11. cout << "Введите секунды : " ;
  12. long seconds;
  13. cin >> seconds;
  14. cout << seconds << " seconds = " ;
  15. if(seconds / days > 0)
  16. cout << seconds / days << " дней, " ;
  17. seconds %= days ;
  18. if(seconds / hours > 0)
  19. cout << seconds / hours << " часов, " ;
  20. seconds %= hours ;
  21. if(seconds / minutes > 0)
  22. cout << seconds / minutes << " минут, " ;
  23. seconds %= minutes ;
  24. cout << seconds << " секунды" ;
  25. return 0;
  26. }
  27. 2.2
  28. #include <iostream>
  29. #include <iomanip>
  30. #include <cmath>
  31. using namespace std;
  32.  
  33. int main()
  34. {
  35. const double lm1 = 60;
  36. const double ms1 = 60;
  37.  
  38. cout << "Введите широту в градусах, минутах и секундах:" << endl;
  39. cout << "Во-первых, введите градусы:";
  40. unsigned short l;
  41. cin >> l;
  42. cout << "Далее введите в минутах:";
  43. unsigned short m;
  44. cin >> m;
  45. cout << "Потом введите в секундах:";
  46. unsigned short s;
  47. cin >> s;
  48.  
  49. float m1, d1, df1;
  50. m1 = s / ms1;
  51. d1 = m / lm1;
  52. df1 = l + d1;
  53.  
  54. cout << l << " degrees, " << m << " minutes, " << s << " seconds = " << df1;
  55. return 0;
  56. }
  57. 2.3
  58. #include <iostream>
  59. #include <cmath>
  60. using namespace std;
  61.  
  62. int main()
  63. {
  64. double a,b,c;
  65. cout <<"Введите численновсть страны а:"<< endl;
  66. cin>>a;
  67. cout <<"Введите численность города b:"<< endl;
  68. cin>>b;
  69. c=(a*100)/b;
  70. cout << c << endl;
  71. return 0;
  72. }
  73. 2.4
  74. #include "iostream"
  75. using namespace std;
  76.  
  77. int main()
  78. {
  79. int nomer = 0;
  80. cout << "Введите номер: ";
  81. cin >> nomer;
  82. int a=0, b=0, c=0, d=0, e=0, f=0;
  83. a = nomer % 10;
  84. b = (nomer / 10) % 10;
  85. c = (nomer / 100) % 10;
  86. d = (nomer / 1000) % 10;
  87. e = (nomer / 10000) % 10;
  88. f = (nomer / 100000) % 10;
  89. if (a + b + c == e + d + f)
  90. cout << "Счастливчик" << endl;
  91. else
  92. cout << "Неудачник" << endl;
  93. }
  94.  
  95. 2.5
  96. #include <iostream>
  97. #include <cmath>
  98. using namespace std;
  99. int main ()
  100. {
  101. double x, y, x0, y0, h , v, t;
  102. const double g=9.8;
  103. cout <<"Введите h: "<< endl;
  104. cin>>h;
  105. cout <<"Введите v:"<< endl;
  106. cin>>v;
  107. cout <<"Введите t:"<< endl;
  108. cin>>t;
  109. y0=h;
  110. x0=0;
  111. x=x0+v*t;
  112. y=y0+v*t-((g*t*t)/2);
  113. cout << x << endl;
  114. cout << y << endl;
  115. return 0;
  116. }
Add Comment
Please, Sign In to add comment