bycj.net
当前位置:首页 >> C语言如何编写随机出10道加减填空题,并将错题保存... >>

C语言如何编写随机出10道加减填空题,并将错题保存...

获取文件长度,分为十段,并将分段信息保存下来(每段文件名、长度等等) 重新读取文件,分段信息+读取之前分的长度,按分配的文件名保存 继续读取,继续保存 解析分段信息,一个个文件进行读取,存入一个文件中即可

#include "stdio.h" #include "stdlib.h" #include "time.h" #include "string while (1) { firstNum = rand() % 10; secondNum = rand() % 10; operatorNum = rand() %

楼上的是c++的吧.#include <stdlib.h> main() { int num1,num2,result,flag; result=-1; flag=1; while(flag) { num1=random(10); num2=random(10); printf("%d+%d=",num1,num2); scanf("%d",&result); if(result==num1+num2)printf("Right!\n");

用rand()产生随机数,rand()会产生从0到一个很大的数,我记不清了,反正很大.如果想出现100以内的,就用rand()%100.你可以定义三个int型整数,两个表示加或者减的对象,另一个标示加或者减,因为只要出现两种情况之一,所以

#include int main() { int a,i,j; for(a=0;a

#include#include#includevoidmain(){inta[100];inti,j,n,m,k;for(i=0;ia[m+1]){k=a[m];a[m]=a[m+1];a[m+1]=k;}}}printf("产生的随机数由小到大排序为:\n");for(j=0;j

#include <stdlib.h> main() { int num1,num2,result,flag; result=-1; flag=1; while(flag) { num1=random(10); num2=random(10); printf("%d+%d=",num1,num2); scanf("%d",&result); if(result==num1+num2)printf("Right!\n"); else printf("Error!\n"); printf("1.continue 2.exit\n"); scanf("%d",&flag); if(flag!=1)flag=0; } }

#include#include#include int num1 = 0;int num2 = 0;int operator = 0;int getTwoNumber(){ int&n

# include \"stdlib.h\"void main(){ char str[100]; int times,i,mark,num1,num2,result; mark=0; printf(\"1.10 questions 2.20 questions\\n\"); scanf(\"%d\",*); for(i=0;i<times;i++) { num1=random(10); num2=random(10); printf(\"%d+%d=\",num1,

#include void main() {int i,j=0,a,b,c,sum=0,n; srand((unsigned)time(null)); for(i=1;;i++) {n=0; j++; if(j==51)break; if(i%2){printf("第%d题:",j);j--;} if(i%2)a=rand()%10+1; if(i%2==0) {b=rand()%10+1; loop:printf("%d+%d=",a,b); scanf("%d",&c);

zxqk.net | jamiekid.net | acpcw.com | gpfd.net | jtlm.net | 网站首页 | 网站地图
All rights reserved Powered by www.bycj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com