Skip to content

Instantly share code, notes, and snippets.

1)
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(0));
const int nums = 10;
int a[nums];
1)
#include <iostream>
using namespace std;
int main() {
int N;
cout << "Enter height triangle (N): ";
cin >> N;
for (int i = 1; i <= N; ++i) {
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) {
#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 = '$';
#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);
#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;
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 << " ";
#include <iostream>
using namespace std;
void obmin(int* a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
int main() {
#ifndef MYARRAY_H
#define MYARRAY_H
#include <iostream>
#include <cstdlib>
#include <ctime>
namespace MyArray {
//a
#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 };