Please I'm going mad!
Code: Select all
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <regex>
int main (){
std::regex neg ("[0-9]*35");
std::regex failed ("9[0-9]*4");
std::regex notComp ("190[0-9]*");
std::string exper;
long long N;
scanf ("%lld", &N);
for (long long i=0; i<N; i++){
std::cin >> exper;
if (strcmp(exper.c_str(), "1") == 0 || strcmp(exper.c_str(), "4") == 0 || strcmp(exper.c_str(), "78") == 0){
std::cout << ((i==N-1)? "+" : "+\n");
continue;
}
if (std::regex_match(exper, neg)){
std::cout << ((i==N-1)? "-" : "-\n");
continue;
}
if (std::regex_match(exper, failed)){
std::cout << ((i==N-1)? "*" : "*\n");
continue;
}
if (std::regex_match(exper, notComp)){
std::cout << ((i==N-1)? "?" : "?\n");
continue;
}
}
return 0;
}