Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h> // для time()
- #include <stdlib.h> // для rand()
- using namespace std;
- void Hello() { // функция не принимает параметров и не возвращает значение
- cout << "Hello World!" << endl;
- cout << "Hello World!" << endl;
- }
- void Star(int count) { // функция принимает один параметр и не возвращает значение
- for (int i = 0; i < count; i++) {
- cout << '*';
- }
- cout << endl;
- }
- void Line(char symb, int count) { // функция принимает два параметра и не возвращает значение
- for (int i = 0; i < count; i++) {
- cout << symb;
- }
- cout << endl;
- }
- int Pow(int digit, int pow) { // принимает два параметра и возвращает значение
- int temp = 1;
- for (int i = 0; i < pow; i++) {
- temp *= digit;
- }
- return temp;
- }
- int Min(int a, int b) {
- return a < b ? a : b;
- }
- void Init(int arr[], const int size) {
- for (int i = 0; i < size; i++) {
- arr[i] = rand() % 100;
- }
- }
- void Print(int arr[], const int size) {
- for (int i = 0; i < size; i++) {
- cout << arr[i] << " ";
- }
- cout << endl;
- }
- int main() {
- setlocale(LC_ALL, "ru");
- const int size = 5;
- int arr[size];
- Init(arr, size);
- Print(arr, size);
- arr[0] = 33;
- Hello();
- Star(20);
- Line('#', 30);
- cout << 2 + Pow(2, 4) << endl;
- int a = 15, b = 10;
- cout << Min(a, b) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement