Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2.1
- #include <iostream>
- using namespace std;
- int main()
- {
- const long minutes = 60;
- const long hours = 60*minutes;
- const long days = 24*hours;
- cout << "Введите секунды : " ;
- long seconds;
- cin >> seconds;
- cout << seconds << " seconds = " ;
- if(seconds / days > 0)
- cout << seconds / days << " дней, " ;
- seconds %= days ;
- if(seconds / hours > 0)
- cout << seconds / hours << " часов, " ;
- seconds %= hours ;
- if(seconds / minutes > 0)
- cout << seconds / minutes << " минут, " ;
- seconds %= minutes ;
- cout << seconds << " секунды" ;
- return 0;
- }
- 2.2
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main()
- {
- const double lm1 = 60;
- const double ms1 = 60;
- cout << "Введите широту в градусах, минутах и секундах:" << endl;
- cout << "Во-первых, введите градусы:";
- unsigned short l;
- cin >> l;
- cout << "Далее введите в минутах:";
- unsigned short m;
- cin >> m;
- cout << "Потом введите в секундах:";
- unsigned short s;
- cin >> s;
- float m1, d1, df1;
- m1 = s / ms1;
- d1 = m / lm1;
- df1 = l + d1;
- cout << l << " degrees, " << m << " minutes, " << s << " seconds = " << df1;
- return 0;
- }
- 2.3
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double a,b,c;
- cout <<"Введите численновсть страны а:"<< endl;
- cin>>a;
- cout <<"Введите численность города b:"<< endl;
- cin>>b;
- c=(a*100)/b;
- cout << c << endl;
- return 0;
- }
- 2.4
- #include "iostream"
- using namespace std;
- int main()
- {
- int nomer = 0;
- cout << "Введите номер: ";
- cin >> nomer;
- int a=0, b=0, c=0, d=0, e=0, f=0;
- a = nomer % 10;
- b = (nomer / 10) % 10;
- c = (nomer / 100) % 10;
- d = (nomer / 1000) % 10;
- e = (nomer / 10000) % 10;
- f = (nomer / 100000) % 10;
- if (a + b + c == e + d + f)
- cout << "Счастливчик" << endl;
- else
- cout << "Неудачник" << endl;
- }
- 2.5
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main ()
- {
- double x, y, x0, y0, h , v, t;
- const double g=9.8;
- cout <<"Введите h: "<< endl;
- cin>>h;
- cout <<"Введите v:"<< endl;
- cin>>v;
- cout <<"Введите t:"<< endl;
- cin>>t;
- y0=h;
- x0=0;
- x=x0+v*t;
- y=y0+v*t-((g*t*t)/2);
- cout << x << endl;
- cout << y << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment