1~100的加发
#include <iostream>
#include <cstdlib>
#include <ctime>
int main(){
srand(time(0));
int n;
int m;
int d;
int sum=0;
std::cout<<"答题游戏开始!\n";
while(true){
n=rand()%100+1;
m=rand()%100+1;
std::cout<<n<<"+"<<m<<"=\n";
std::cin>>d;
if(d==n+m){
std::cout<<"答对了!\n";
sum++;
std::cout<<"得分:"<<sum<<"\n";
}else{
std::cout<<"答错了!\n";
return 0;
}
}
return 0;
}