用Microsoft Visual C++ 6.0 (17)给小学生出加法考试题 跪求C语言程序编写高手

2024-12-08 08:17:27
推荐回答(3个)
回答(1):

LZ非常对不起,我不熟悉C语言的头文件和打印所需的函数,我学C++的,这里提供程序4的C++代码,如果还需要其他几个程序的代码请留言给我:
#include
#include
using namespace std;

int main ()
{
srand (time(0));
int a,b,ans,i,score;
score = 0;
for (i = 0; i < 10; i++)
{
a = rand() % 10 + 1;
b = rand() % 10 + 1;
cout << a << '+' << b << "= ? ";
cin >> ans;
if (ans == a + b)
{
cout << "Right!" << endl;
score++;
}
else
{
cout << "Not correct!" << endl;
}
}
cout << "Your totle score is: " << score << " !" << endl;
return 0;
}

验证过,运行正确

回答(2):


c语言可以用Microsoft Visual C++ 6.0来进行编译,至于.cpp还是.c,这个关系不大,反正都可以在Microsoft Visual C++ 6.0中执行。

回答(3):

程序5 ···