commit
d6d1f93818
@ -0,0 +1,28 @@
|
||||
# Project: Pupil test
|
||||
# Makefile created by Dev-C++ 5.11
|
||||
|
||||
CPP = g++.exe
|
||||
CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
OBJ = main.o
|
||||
LINKOBJ = main.o
|
||||
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -m32
|
||||
INCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
|
||||
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
|
||||
BIN = "Pupil test.exe"
|
||||
CXXFLAGS = $(CXXINCS) -m32
|
||||
CFLAGS = $(INCS) -m32
|
||||
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)
|
@ -0,0 +1,51 @@
|
||||
[Project]
|
||||
FileName=Pupil test.dev
|
||||
Name=Pupil test
|
||||
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=3
|
||||
CompilerSettings=0000000100000000000000000
|
||||
|
||||
[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
|
||||
|
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
[Editors]
|
||||
Order=0
|
||||
Focused=0
|
||||
[Editor_0]
|
||||
CursorCol=34
|
||||
CursorRow=62
|
||||
TopLine=44
|
||||
LeftChar=1
|
@ -0,0 +1,69 @@
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
#include<conio.h>
|
||||
#include<string.h>
|
||||
|
||||
void main()
|
||||
{
|
||||
int num=0,add=0; /* 答题数,总分 */
|
||||
int score[3]={10,7,5};/*得几分*/
|
||||
char str[20],str1[10][20];
|
||||
|
||||
while(1)
|
||||
{
|
||||
int a=0,b=0,d=0,c=0,k=0,i=0,j=-1,result;
|
||||
char sf[2]={'+','-'};/* 符号 */
|
||||
while(1)
|
||||
{
|
||||
a=rand()%51;/*0-50的随机数*/
|
||||
b=rand()%51;/*0-50的随机数*/
|
||||
d=rand()%2;/* 随机符号 */
|
||||
if(d==0)c=a+b;
|
||||
else c=a-b;
|
||||
if(c>=0 && c<=50)/* 如果相同重新出题 */
|
||||
{
|
||||
sprintf(str,"%d %c %d = \n",a,sf[d],b);
|
||||
strcpy(str1[num],str);
|
||||
if(num==0) break;
|
||||
j=-1;
|
||||
for(i=0; i<num; i++)
|
||||
{
|
||||
if(strcmp(str,str1[i])==0)
|
||||
{ j=1;break;}
|
||||
}
|
||||
if(j<0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("%s\n",str);/* 回答 */
|
||||
printf("输入计算结果:\n");
|
||||
while(1)
|
||||
{
|
||||
scanf("%d",&result);
|
||||
k++;
|
||||
if(result==c)
|
||||
{
|
||||
printf("回答正确!\n");
|
||||
add+=score[k-1];
|
||||
break;
|
||||
}
|
||||
else if(k<3)
|
||||
{
|
||||
printf("错误,请重新回答:\n");
|
||||
}
|
||||
else
|
||||
{ printf("错误,正确答案: %d\n",c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
num++;
|
||||
if(num==10)break;
|
||||
}
|
||||
if(add>=90)printf("\nSMART\n");
|
||||
else if(add>=80)printf("\nGOOD\n");
|
||||
else if(add>=70)printf("\nOK\n");
|
||||
else if(add>=60)printf("\nPASS\n");
|
||||
else printf("\nTRY AGAIN\n");
|
||||
getch();
|
||||
}
|
||||
|
Loading…
Reference in new issue