#include stdlib.h
#include stdio.h
#include math.h
#include time.h
#define numOfQuestions 10
void main()
{
srand(1);
for(int i=0;inumOfQuestions ;i++)
{
bool add = rand()%2;
char oper = '-';
if(add) oper = '+';
int a = rand()%100;
int b = rand()%100;
if(!add)
{
while(ba)b = rand()%100;
}
printf(%d %c %d =?, a, oper, b);
int answer = 0;
scanf(%d, &answer);
bool correct = false;
if(add)
{
if(answer == (a + b)) correct = true;
}
else
{
if(answer == (a - b)) correct = true;
}
if(correct)printf(回答正确!\n);
else printf(回答错误!\n);
}
}
写到文件 (编辑框4.内容+/+编辑框1.内容+.+编辑框2.内容,到字节集(编辑框3.内容))
先托过来一个时钟组件,把时钟周期设成 1000,然后在要显示的地方写上代码 =到文本 (取现行时间 ())
#includestdio.hmain(){int a;printf(how old are you ?\n);printf(Input you age:\n);scanf(%d,&a);printf(your age is %d\n,a);printf(I love you ^ - ^); }
举报成功
经过核实后将会做出处理
感谢您为社区和谐做出贡献
扫码参与新品0元试用
晒单、顶楼豪礼等你拿