王罗凯 6 years ago
commit fe981749d8

@ -0,0 +1,28 @@
# Project: ÏîÄ¿1
# Makefile created by Dev-C++ 5.11
CPP = g++.exe -D__DEBUG__
CC = gcc.exe -D__DEBUG__
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"D:/dvc/Dev-Cpp/MinGW64/lib" -L"D:/dvc/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -g3
INCS = -I"D:/dvc/Dev-Cpp/MinGW64/include" -I"D:/dvc/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"D:/dvc/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"D:/dvc/Dev-Cpp/MinGW64/include" -I"D:/dvc/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"D:/dvc/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"D:/dvc/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = ÏîÄ¿1.exe
CXXFLAGS = $(CXXINCS) -g3
CFLAGS = $(INCS) -g3
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)

108
main.c

@ -0,0 +1,108 @@
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
int main(){
int choice;
printf("欢迎使用学生考试系统\n");
char name[100];
char xuehao[110];
//设置两个储存姓名和学号的字符串数组
printf("请选择系统功能选项1登入 0退出\n") ;
//模拟正式考试系统时的考试界面
scanf("%d",&choice);
switch(choice)
{
case 1:printf("请输入你的姓名、学号\n");
scanf("%s",name);
scanf("%s",xuehao);
//使用字符串数组输入姓名和学号
int a,b,c,i,j,score[10],trueValue,sum=0;
srand(time(NULL));
for( i=0;i<10;i++){
for(a=rand()%51,b=rand()%51;a+b>50 || a+b<0 || a-b>50 || a-b<0; a=rand()%51,b=rand()%51)
c=rand()%2;
//使用rang函数随机生成[050]以内的数字
//c随机生成0和1分别对应加法和减法
for( j=0;j<3;j++){
if(c==1){
printf("%d:%d+%d=",i+1,a,b);
trueValue=a+b;
//加法公式
scanf("%d",&score[i]);
if(score[i]!=trueValue){
printf("答案错误,请重新输入.\n");
score[i]=0;
}
else{
if(j==0){
score[i]=10;
}
else if(j==1){
score[i]=7;
}
else{
score[i]=5;
}
break;
}
}
//加法的计分方式
else{
printf("%d:%d-%d=",i+1,a,b);
trueValue=a-b;
//减法的公式
scanf("%d",&score[i]);
if(score[i]!=trueValue){
printf("答案错误,请重新输入.\n");
score[i]=0;
}
else{
if(j==0){
score[i]=10;
}
else if(j==1){
score[i]=7;
}
else{
score[i]=5;
}
break;
}
}
}
if(score[i]==0){
printf("正确答案是:%d\n",trueValue);
}
//减法的计分方式
sum=sum+score[i];
}
printf("你的成绩是:%d\n",sum);
if(sum>90){
printf("SMART.\n");
}
else if(sum>=80){
printf("GOOD.\n");
}
else if(sum>=70){
printf("OK.\n");
}
else if(sum>=60){
printf("PASS.\n");
}
else{
printf("TRYAGAIN\n");
}
break;
case 0:break;}
return 0;
}

BIN
main.o

Binary file not shown.

@ -0,0 +1,62 @@
[Project]
FileName=ÏîÄ¿1.dev
Name=ÏîÄ¿1
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=1
CompilerSettings=0000000000000000001000000
UnitCount=1
[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=

Binary file not shown.
Loading…
Cancel
Save