日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

c语言 10以内加法,求助 给小学生出题,自己选加减乘除 做10题 10以内的数 然后统计分...

發布時間:2025/3/20 60 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言 10以内加法,求助 给小学生出题,自己选加减乘除 做10题 10以内的数 然后统计分... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規已被系統折疊?隱藏此樓查看此樓

#include?

#include?

#include?

void?Menu(void)

{

printf("1,加法?2,減法?3,乘法?4,除法?5,退出\n");

printf("請選擇題目類型:");

}

int?Plus(void)

{

int?a,?b;

a?=?rand()?%?10?+?1;

b?=?rand()?%?10?+?1;

printf("%-2d?+?%-2d?=?",?a,?b);

return?a?+?b;

}

int?Sub(void)

{

int?a,?b;

a?=?rand()?%?10?+?1;

b?=?rand()?%?10?+?1;

printf("%-2d?-?%-2d?=?",?a,?b);

return?a?-?b;

}

int?Mult(void)

{

int?a,?b;

a?=?rand()?%?10?+?1;

b?=?rand()?%?10?+?1;

printf("%-2d?*?%-2d?=?",?a,?b);

return?a?*?b;

}

int?Div(void)

{

int?a,?b;

while(a?%?b?!=?0)

{

a?=?rand()?%?10?+?1;

b?=?rand()?%?10?+?1;

}

printf("%-2d?/?%-2d?=?",?a,?b);

return?a?/?b;

}

int?Subject(int?type)

{

switch(type)

{

case?1:?return?Plus();

case?2:?return?Sub();

case?3:?return?Mult();

case?4:?return?Div();

}

}

void?Do(int?type)

{

int?count?=?0,?score?=?0,?key,?answer;

while(count?

{

key?=?Subject(type);

scanf("%d",?&answer);

if(key?==?answer)

score?+=?10;

count++;

}

printf("%d\n",?score);

}

int?main(void)

{

int??type,?score;

while(1)

{

Menu();

scanf("%d",?&type);

if(type?==?5)?return?0;

Do(type);

system("pause");

system("cls");

}

}

總結

以上是生活随笔為你收集整理的c语言 10以内加法,求助 给小学生出题,自己选加减乘除 做10题 10以内的数 然后统计分...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。