35657

Untitled

Dec 2nd, 2023
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. // функция не принимает параметров и не возвращает значения
  7. void Hello() {
  8.     cout << "Hello, World!!!" << endl;
  9. }
  10.  
  11.  
  12. // функция принимает один параметр и не возвращает значения
  13. void Star(int count) {
  14.     for (int i = 0; i < count; i++) {
  15.         cout << '*';
  16.     }
  17.     cout << endl;
  18. }
  19.  
  20. // функция принимает два параметра и не возвращает значения
  21. void AnyLine(char symb, int count) {
  22.     for (int i = 0; i < count; i++) {
  23.         cout << symb;
  24.     }
  25.     cout << endl;
  26. }
  27.  
  28. // функция принимает два параметра и возвращает значения
  29. int Pow(int Digit, int Pow) {
  30.     int key = 1;
  31.     for (int i = 0; i < Pow; i++) {
  32.         key *= Digit;
  33.     }
  34.     return key;
  35. }
  36.  
  37. // функция принимает два параметра и возвращает значения
  38. int Min(int a, int b) {
  39.     return a < b ? a : b;
  40. }
  41.  
  42. int main() {
  43.     Hello();
  44.     Hello();
  45.     Hello();
  46.  
  47.     Star(3);
  48.     Star(5);
  49.  
  50.     AnyLine('=', 10);
  51.  
  52.     int result = Pow(3, 3);
  53.     cout << result << endl;
  54.  
  55.     cout << Min(3, 7) << endl;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment