Работы по программированию

This commit is contained in:
IgorVolochay
2026-07-28 09:56:54 +03:00
parent b85155ff95
commit 8602b7e845
73 changed files with 4090 additions and 0 deletions
@@ -0,0 +1,38 @@
#include <graphics.h>
#include <iostream>
#include <fstream>
#include <vector>
void drawBarChart(const std::vector<int>& temperatures) {
int x = 50;
for (int temp : temperatures) {
bar(x, 400 - temp * 2, x + 30, 400);
x += 40;
}
}
std::vector<int> readTemperatures(const std::string& filename) {
std::ifstream file(filename);
std::vector<int> temperatures;
int temp;
while (file >> temp) {
temperatures.push_back(temp);
}
return temperatures;
}
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
std::vector<int> temperatures = readTemperatures("temperatures.txt");
drawBarChart(temperatures);
getch();
closegraph();
return 0;
}