first commit

master
1304772892@qq.com 6 years ago
commit 64a4a79385

@ -0,0 +1,43 @@
# Project: СѧÉú²âÑé
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o test.o record.o load.o ../pupil_test/save.o setting.o
LINKOBJ = main.o test.o record.o load.o ../pupil_test/save.o setting.o
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = СѧÉú²âÑé.exe
CXXFLAGS = $(CXXINCS) -std=c99
CFLAGS = $(INCS) -std=c99
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
test.o: test.c
$(CC) -c test.c -o test.o $(CFLAGS)
record.o: record.c
$(CC) -c record.c -o record.o $(CFLAGS)
load.o: load.c
$(CC) -c load.c -o load.o $(CFLAGS)
../pupil_test/save.o: ../pupil_test/save.c
$(CC) -c ../pupil_test/save.c -o ../pupil_test/save.o $(CFLAGS)
setting.o: setting.c
$(CC) -c setting.c -o setting.o $(CFLAGS)

@ -0,0 +1,21 @@
#include"main.h"
load(int v){
dif=0;
FILE *precord=fopen("record.txt","r");
fscanf(precord,"%d%d%d",&range,&kind,&voice);
if(range==1) dif+=2;
if(kind==1) dif++;
for(int i=0;i<4;i++){
for(int j=0;j<10;j++){
fscanf(precord,"%s%d%f",&dates[i][j].name,&dates[i][j].scores,&dates[i][j].time);
}
}
fclose(precord);
}

BIN
load.o

Binary file not shown.

@ -0,0 +1,47 @@
#include"main.h"
int range,kind,voice,dif;
date dates[4][11];
int main(void){
char choice;
srand(time(NULL));
load(1);
do{
printf("\n\n\n\n\n\n\t\t\t欢迎使用小学生测验\n\n");
printf("\t\t\t1.开始测验\n\n");
printf("\t\t\t2.排名\n\n");
printf("\t\t\t3.设置\n\n");
printf("\t\t\t4.退出\n\n");
printf("\t\t\t(输入选项前数字进行相应的操作)\n\n\t\t\t");
do{ //选择判断
choice=getch(); if(voice==1) printf("\a");
if(choice>='1'&&choice<='4'){
system("cls");
if(choice=='1') test(1);
if(choice=='2') record(1);
if(choice=='3') setting(1);
break;
}else printf("\n\t\t\t输入错误\n\n\t\t\t");
}while(choice!='4');
}while(choice!='4');
save(1);
return 0;
}

Binary file not shown.

@ -0,0 +1,19 @@
#include<windows.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
typedef struct date{
char name[11];
int scores;
float time;
}date;
extern int range,kind,voice,dif;
extern date dates[4][11];
test(int v);
record(int v);
load(int v);
save(int v);

BIN
main.o

Binary file not shown.

@ -0,0 +1,20 @@
#include"main.h"
record(int v){
if(range==0) printf("\n\t\t\t\t100以内");
else printf("\n\t\t\t\t1000以内");
if(kind==0) printf("加减法\n\n");
else printf("乘除法\n\n");
printf("\t\t\t排名 名字 成绩 时间\n\n");
for(int i=0;i<10;i++){
printf("\t\t\t%2d. %-5s %3d分 %5.2f秒\n\n",i+1,dates[dif][i].name,dates[dif][i].scores,dates[dif][i].time);
}
printf("\t\t\t按任意键返回菜单");
getch(); if(voice==1) printf("\a");
system("cls");
}

Binary file not shown.

@ -0,0 +1,41 @@
0 0 0
쭈니 100 57.33
쭈니 60 40.73
쭈니 10 10.45
crf 10 13.91
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00
0 0 0.00

@ -0,0 +1,15 @@
#include"main.h"
save(int v){
FILE *precord=fopen("record.txt","w");
fprintf(precord,"%d %d %d\n",range,kind,voice);
for(int i=0;i<4;i++){
for(int j=0;j<10;j++){
fprintf(precord,"%s %d %.2f\n",dates[i][j].name,dates[i][j].scores,dates[i][j].time);
}
}
fclose(precord);
}

BIN
save.o

Binary file not shown.

@ -0,0 +1,63 @@
#include"main.h"
void setting(int v){
char choice;
do{
printf("\n\n\n\n\n\n\t\t\t\t设置\n\n");
printf("\t\t\t1.范围····> ");
if(range==0) printf("100以内\n\n");
else printf("1000以内\n\n");
printf("\t\t\t2.运算符···> ");
if(kind==0) printf("加减\n\n");
else printf("乘除\n\n");
printf("\t\t\t3.声音····> ");
if(voice==0) printf("\n\n");
else printf("\n\n");
printf("\t\t\t4.返回菜单\n\n");
do{ //选择判断
choice=getch();
if(choice>='1'&&choice<='4'){
if(choice=='1'){
range++;
range%=2;
}
if(choice=='2'){
kind++;
kind%=2;
}
if(choice=='3'){
voice++;
voice%=2;
}
if(voice==1) printf("\a");
break;
}else printf("\n\t\t\t输入错误\n\n\t\t\t");
}while(choice!='4');
system("cls");
}while(choice!='4');
dif=0;
if(range==1) dif+=2;
if(kind==1) dif++;
}

Binary file not shown.

196
test.c

@ -0,0 +1,196 @@
#include"main.h"
test(int v){ //测验函数
date max;
int a,b;
int sign;
int scores=0;
int ran=100;
int sta=0;
double time;
char question[22],wro_set[222];
char truth[11],answer[11];
if(range==1) ran=1000;
clock_t start,end;
printf("\n\n\n\n\n\n");
for(int i=3;i>0;i--){
printf("\t\t\t测验将在%d秒后开始\n\n",i); if(voice==1) printf("\a");
sleep(1);
}
system("cls");
start=clock();
for(int i=0;i<10;i++){ //随机出题
printf("\n\n\n\n\n\n\n\t\t\t输入exit直接退出测验");
if(kind==0){
do{
a=rand()%(ran-ran/10)+ran/10+1;
b=rand()%(ran-ran/10)+ran/10+1;
sign=rand()%2;
if(sign==0) sign=-1;
}while((a+sign*b)<ran/10||(a+sign*b)>ran);
sprintf(truth,"%d",a+sign*b);
if(sign==1) sprintf(question,"\n\n\t\t\t第%-2d题:%d+%d=",i+1,a,b);
if(sign==-1) sprintf(question,"\n\n\t\t\t第%-2d题:%d%d=",i+1,a,-1*b);
}else{
do{
a=rand()%(ran-4)+3;
b=rand()%(ran-4)+3;
sign=rand()%2;
if(sign==0){
if((a/b)>=3&&(a/b)<=ran&&(a%b==0))
break;
}else{
if((a*b)>=10&&(a*b)<=ran)
break;
}
}while(1);
if(sign==0) sprintf(truth,"%d",a/b);
else sprintf(truth,"%d",a*b);
if(sign==0) sprintf(question,"\n\n\t\t\t第%-2d题:%d/%d=",i+1,a,b);
else sprintf(question,"\n\n\t\t\t第%-2d题:%d*%d=",i+1,a,b);
}
printf("%s",question);
for(int j=2;j>=0;j--){
printf("\n\n\t\t\t您的答案是:");
scanf("%s",&answer); if(voice==1) printf("\a");
if((strcmp(answer,"exit"))==0) goto exit;
if((strcmp(answer,truth))==0){
if(j==2) scores+=10;
if(j==1) scores+=7;
if(j==0) scores+=5;
printf("\t\t\t答案正确\n\n");
break;
}else{
printf("\t\t\t答案错误 您还有%d次机会",j);
if(j==0){
sta=1;
strcat(wro_set,question);
strcat(wro_set,truth);
}
}
}
system("cls");
}
end=clock();
time=(float)(end-start)/CLK_TCK;
if(sta==1){
system("cls");
printf("\n\n\n\n\n\n\t\t\t本次测验错题%s",wro_set);
printf("\n\n\t\t\t按下任意键继续");
getch();
system("cls");
}
printf("\n\n\n\n\n\n\t\t\t测验结束,您的成绩是:\n\n\t\t\t%d分 ",scores);
switch(scores/10){ //等级判定
case 10:{
printf("满分");
break;
}
case 9:{
printf("优秀");
break;
}
case 8:{
printf("良好");
break;
}
case 7:
case 6:{
printf("及格");
break;
}
default :{
printf("不及格");
break;
}
}
printf(" 用时%.2f秒\n\n",time);
printf("\t\t\t输入你的名字后返回菜单\n\n");
printf("\t\t\t君的名字:");
scanf("%s",&dates[dif][10].name); if(voice==1) printf("\a");
dates[dif][10].scores=scores;
dates[dif][10].time =time;
for(int i=0;i<10;i++){
max=dates[dif][i];
for(int j=i+1;j<11;j++){
if(max.scores<dates[dif][j].scores){
max =dates[dif][j];
dates[dif][j]=dates[dif][i];
dates[dif][i]=max;
}
if(max.scores==dates[dif][j].scores){
if(max.time>dates[dif][j].time){
max =dates[dif][j];
dates[dif][j]=dates[dif][i];
dates[dif][i]=max;
}
}
}
}
exit:
system("cls");
}

BIN
test.o

Binary file not shown.

@ -0,0 +1,122 @@
[Project]
FileName=СѧÉú²âÑé.dev
Name=СѧÉú²âÑé
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
UseCustomMakefile=0
CustomMakefile=
CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000000
UnitCount=7
[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1
[Unit1]
FileName=main.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=test.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=main.h
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=record.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=load.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=save.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit7]
FileName=setting.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

Binary file not shown.

@ -0,0 +1,38 @@
[Editors]
Order=0,1,3,4,5,6,2
Focused=2
[Editor_0]
CursorCol=4
CursorRow=38
TopLine=5
LeftChar=1
[Editor_1]
CursorCol=24
CursorRow=124
TopLine=154
LeftChar=1
[Editor_2]
CursorCol=13
CursorRow=10
TopLine=1
LeftChar=1
[Editor_3]
CursorCol=2
CursorRow=9
TopLine=1
LeftChar=1
[Editor_4]
CursorCol=2
CursorRow=8
TopLine=1
LeftChar=1
[Editor_5]
CursorCol=2
CursorRow=15
TopLine=1
LeftChar=1
[Editor_6]
CursorCol=8
CursorRow=59
TopLine=1
LeftChar=1
Loading…
Cancel
Save