#include <iostream>
#include <cstdlib>
#include <ctime>

int generateRandomNumber(int max) {
    return rand() % max + 1;
}

char generateOperator() {
    char operators[] = {'+', '-'};
    return operators[rand() % 2];
}
int doCount(int num1,int num2,char op){
    if(op == '+'){
        return num1 + num2;
    }else{
        return num1 - num2;
    }
}
bool checkRes(int num)
{
    if(num > 100 || num <0){
        return false;
    }
    return true;
}
void fun(){
    char op1,op2;
    int num1,num2,num3;
    int res ;
    do{
        op1 =  generateOperator();

        num1 = generateRandomNumber(100);
        num2 = generateRandomNumber(100);
        res = doCount(num1,num2,op1);
        // 如果检查不通过
        if(!checkRes(res)){
            continue;
        }
        op2 =  generateOperator();
        num3 = generateRandomNumber(100);
        res = doCount(res,num3,op2);
    }while(!checkRes(res));
    std::cout<<num1<<op1<<num2<<op2<<num3<<"=";

}
int main() {
     srand(static_cast<unsigned int>(time(0))); 
    for(int i = 0 ;  i < 1000; i++){
        for(int j = 0 ; j < 3 ; j++){
            fun();
            std::cout<<"\t\t";
        }
        std::cout<<std::endl;
    }
    return 0;
}