Petro_zzz

lesson5_322

Jul 14th, 2023
1,254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. void test_convert() {
  7.     int Щ = 12;
  8.     cout << Щ << endl;
  9.  
  10.     cout << "Test convert type" << endl;
  11.     double v = 10;    //  час / землекопы
  12.     double t_max = 3; //  час
  13.     int n = (int)ceil(v / t_max);
  14.     cout << "Потребуется " << n << " землекопов." << endl;
  15.     cout << "Потребуется " << v / t_max << " землекопов." << endl;
  16.  
  17.     char ch = 'g';
  18.     cout << ch << " " << (int)ch << endl;
  19.     cout << 104 << " " << (char)104 << endl;
  20.      
  21.     bool flag = true;
  22.    
  23.     cout << "true " << flag << endl;
  24.     cout << "false " << false << endl;
  25.  
  26.     flag = 1;
  27.     cout << "true " << flag << endl;
  28.  
  29.     flag = -1;
  30.     cout << "true " << flag << endl;
  31.  
  32.     flag = 0;
  33.     cout << "flag " << flag << endl;
  34. }
  35.  
  36. void two_numer() {
  37.     double x, y;
  38.     cout << "Enter x ";
  39.     cin >> x;
  40.     cout << "Enter y ";
  41.     cin >> y;
  42.     cout << "x + y  = " << x + y << endl
  43.         << "x * y  = " << x * y << endl
  44.         << "Av(x,y)= " << (x + y) / 2 << endl;
  45. }
  46.  
  47. void three_numer() {
  48.     double x, y, z;
  49.     cout << "Enter x ";
  50.     cin >> x;
  51.     cout << "Enter y ";
  52.     cin >> y;
  53.     cout << "Enter z ";
  54.     cin >> z;
  55.  
  56.     cout << "x + y  = " << x + y + z << endl
  57.         << "x * y  = " << x * y * z<< endl
  58.         << "Av(x,y)= " << (x + y + z) / 3 << endl;
  59. }
  60.  
  61.  
  62. int main() {
  63.     //setlocale(LC_ALL, "ru");
  64.     //test_convert();
  65.     two_numer();
  66.     three_numer();
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment