#include <iostream>
#include <string>
int main()
{
int t, x;
std::cout << "Ile testow: ";
std::cin >> t;
std::string test[t];
int c_[t], k_[t], w_[t];
for (int i=0; i<t; ++i)
{
std::cout << "----" << i+1 << "----\n";
std::cin >> c_[i];
std::cin >> k_[i];
std::cin >> w_[i];
x = c_[i] * w_[i];
if(x <= k_[i])
{
test[i] = "TAK";
}
else
{
test[i] = "NIE";
}
}
std::cout << "\n";
// Prezentacja testow
for (int i=0; i<t; ++i)
{
printf("%-2i %-2i %-2i ", c_[i], k_[i], w_[i]);
if (test[i] == "TAK")
{
printf("%c[%dm%s%c[%dm\n", 0x1B, 32, test[i].c_str(), 0x1B, 0); // green
}
else // NIE
{
printf("%c[%dm%s%c[%dm\n", 0x1B, 31, test[i].c_str(), 0x1B, 0); // red
}
}
std::cout << std::endl;
return 0;
}
P.S. c++ - Difference between "endl" and "\n"
std::endl, instead, is an object that will cause to append the newline character ("\n") AND to flush stdout buffer. For this reason it will take more processing. For this reason it will take more processing.