Home > Back-end >  A typing games, can you help me change it, novice, wrong lot, urgent need
A typing games, can you help me change it, novice, wrong lot, urgent need

Time:12-29

#include
#include
#include //the welcome screen
#include
#include
using namespace std;
Void welcome ()
{
//output screen prompts
Cleardevice ();
Setcolor (YELLOW);
The setfont (50, 0, "black");
Outtextxy (160, 10, "play alphabet games");
//implementation flashing "press any key to continue"
Int c=255;
while(! Kbhit ())
{
Setcolor (RGB (c, 0, 0));
Outtextxy (280, 400, "the game start"); C -=8;
If (c<0) c=255;
Sleep (20);
}
getch();
Cleardevice ();
}//exit interface
Void goodbye ()
{
Int s;
Cleardevice ();
Setcolor (YELLOW);
The setfont (48, 0, "black");
Outtextxy (110, 150, "the final result is:");
Outtextxy (110, 250, s);
getch();
}
Void time ()
{
int a,b;
for(a=1; a!=61; +)
{
Char q [5];
Sprintf (q, "% d, b - a);
Outtextxy (20, 20, q);
Sleep (1000);
If (b - a==0)
{
Goto the EXIT;

}
}
}//main function
Void program ()
{
Int s;
Char target [2]="s";//define alphabetic string
Char key;//user key variables
Srand (time (NULL));//set the random seed
The setfont (50, 0, "Arial");//set the font and size of letters
Outtextxy (380, 20, "score:");
Outtextxy (550 s);//the main loop
While (true)
{
Target [0]=65 + rand () % 26;//produce any capital letter
Int x=rand () % 630;
For (int y=0; y<460; Y++)
{
Setcolor (WHITE);//set the color of the letters
Outtextxy (x, y, target);//show the letter
If (kbhit ())
{
Key=getch ();
If ((key==target [0]) | | (key==target [0] + 32))
{
//set to remove
Setcolor (BLACK);
Outtextxy (x, y, target);//remove the original characters
///int i++;
break;//jump out of the loop, the next character
}
Else if (key==27)
{goto the EXIT;//if press ESC to exit the main loop game
} int a;
//sprintf (I, "% d", a);
///outtextxy (520, 20, I);
}
//delay, and remove the original characters
Sleep (10);
Setcolor (BLACK);
Outtextxy (x, y, target);
}
}
}


Int main ()
{
//the initial screen is 640 x480

Initgraph (640, 480);
Welcome ();//show the welcome screen

STD: : thread first (time);
STD: : thread second (program);
First, the join ();
Second. The join ();
EXIT: goodbye ();//exit section
//close the graphical interface
Closegraph ();
}

CodePudding user response:

TC is too old,
I don't Windows 7 has been packed up,

Can study VC6.0