Advertisement
DobriyKrot

Основы С++

Oct 19th, 2022
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     ios_base::sync_with_stdio(false);
  8.     cin.tie(nullptr);
  9.    
  10.     cout << 1234 << '\n';
  11.     cout << 1234 << '\n';
  12.     cout << 1234 << '\n';
  13.     cout << 1234 << '\n';
  14.     cout << 1234 << '\n';
  15.    
  16.     cout.flush();
  17.     cout << 1234 << endl;
  18.    
  19.     cout << 1234 << '\n';
  20.     int x;
  21.     cin >> x;
  22.    
  23.     int x1; // +- 2*10^9
  24.     long long x2; // +- 9*10^18
  25.     double x3;
  26.     char x4 = '1';
  27.    
  28.     unsigned int x5; // 0..4*10^9
  29.     unsigned long long x6; // 0..18*10^18
  30.     size_t x7; // IB 64-бит
  31.    
  32.     cout << (long long)x1 << ' ' << int(x2) << ' ' << (long long)(x1) << ' ' << static_cast<long long>(x1);
  33.    
  34.     cout << x1 + x2 << '\n';
  35.     cout << x2 + x3 << '\n'; // double
  36.    
  37.     cout << char(x4 + x4) << '\n';
  38.     cout << int(x4) << ' ' << char(123) << '\n';
  39.    
  40.     cout << x1 + x5 << '\n'; // unsigned int
  41.    
  42.     vector<int> v = {1, 2};
  43.     cout << 1 - (long long)(v.size()); // -1 unsigned long long
  44.    
  45.    
  46.     cout << fixed << setprecision(15) << x3 << '\n';
  47.    
  48.     bool x5 = false; // true.    
  49.     cout << boolalpha << x5; // False
  50.    
  51.     if (-1) {
  52.         cout << "True";
  53.     }
  54.    
  55.     cout << 1'000'000'000ll * 1'000'000'000;
  56.    
  57.     int a = 10;
  58.     cout << ++a << ' ' << a << '\n' << a++ << ' ' << a << '\n'; // 11 11 11 12
  59.     --a;
  60.     a--;
  61.     cout << a--;
  62.    
  63.     if () {
  64.        
  65.     } else if () {
  66.        
  67.     } else if () {
  68.        
  69.     } else {
  70.        
  71.     }
  72.    
  73.     int n;
  74.     cin >> n;
  75.     int i = 20;
  76.     for (i = 0; i < n; ++i, --n) {
  77.         i += 10;
  78.     }
  79.     while (n > 0) {
  80.         int b1 = 10;
  81.         --n;
  82.     }
  83.     {
  84.         {
  85.             int b1; // мусор
  86.             int sum = 0;
  87.             for (int i = 0; i < n; ++i) {
  88.                 sum += i;
  89.             }
  90.             cout << sum;
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement