Coding Global Background
Coding Global

help plz

Archiviert 6 months ago
12 Nachrichten
4 Mitglieder
7 months ago
In Discord öffnen
L
lomeds
Copy Paster!

void drawMiniGraph(const std::vector<double>& values, int x, int y, int width = 20, int height = 4) { if (values.empty()) return; double maxVal = 1.0; for (const auto& val : values) { if (val > maxVal) maxVal = val; } for (int row = 0; row < height; ++row) { gotoxy(x, y + row); for (int col = 0; col < width && col < static_cast<int>(values.size()); ++col) { int dataIndex = std::max(0, static_cast<int>(values.size()) - width + col); double value = values[dataIndex]; double normalized = value / maxVal; int barHeight = static_cast<int>(normalized * height); if (height - row - 1 < barHeight) { if (value > 80) setColor(settings.colors.critical); else if (value > 60) setColor(settings.colors.warning); else setColor(settings.colors.accent); std::cout << "#"; } else { setColor(settings.colors.background + 8); // Dark gray std::cout << "."; } } } setColor(settings.colors.text); } i am making an app about showing real time stats of pc. like usage of ccpu, gpu etc its saying i have an error in this line of code: int dataIndex = std::max(0, static_cast<int>(values.size()) - width + col); its saying std::max is error and i alredy typed #include <algorithm> can anyone help me?

Antworten (12)