#include<iostream>
int main()
{
float num;
std::cin >> num;
int index = num / 25;
const char* fora[] = {"[0,25]", "(25,50]", "(50,75]", "(75,100]"};
if (num < 0 || num > 100) std::cout << "Fora de intervalo";
else if (index == 0) std::cout << "Intervalo " << fora[0];
else if (num == 25 || num == 75 || num == 50 || num == 100)
std::cout << "Intervalo " << fora[index-1];
else std::cout << "Intervalo " << fora[index];
}
不确定这样是否更简洁。。。。