This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
int main() { | |
srand(time(0)); | |
const int nums = 10; | |
int a[nums]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
#include <iostream> | |
using namespace std; | |
int main() { | |
int N; | |
cout << "Enter height triangle (N): "; | |
cin >> N; | |
for (int i = 1; i <= N; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
void SetColor(int color) { | |
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | |
SetConsoleTextAttribute(hConsole, color); | |
} | |
void Line(int length, char symbol, int color, bool horizontal) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <conio.h> | |
#include <windows.h> | |
using namespace std; | |
const char WALL = '|'; | |
const char EMPTY = ' '; | |
const char PLAYER = 'P'; | |
const char COIN = '$'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <windows.h> | |
using namespace std; | |
void HideCursor(); | |
void InitMap(int map[][65], int height, int width); | |
void DrawMap(HANDLE h, int map[][65], int height, int width); | |
void ShowHero(HANDLE h, COORD hero); | |
void DrawCoinsInfo(HANDLE h, int coins, int width); | |
void ProcessInput(HANDLE h, int map[][65], COORD &hero, int &coins, int height, int width); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <limits> | |
double average(const std::vector<int>& arr) { | |
if (arr.empty()) return 0; | |
double sum = 0; | |
for (int num : arr) { | |
sum += num; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
#include <iostream> | |
void print(int n) { | |
if (n == 0) return; | |
print(n - 1); | |
std::cout << n << " "; | |
2) | |
#include <iostream> | |
void AB(int a, int b) { | |
std::cout << a << " "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void obmin(int* a, int* b) { | |
int temp = *a; | |
*a = *b; | |
*b = temp; | |
} | |
int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MYARRAY_H | |
#define MYARRAY_H | |
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
namespace MyArray { | |
//a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <conio.h> | |
#include <windows.h> | |
using namespace std; | |
const int width = 20; | |
const int height = 20; | |
enum Direction { STOP = 0, LEFT, RIGHT, UP, DOWN }; |
OlderNewer