本文介绍了倒计时可以在后台工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在制作测验计划。我创建了一个倒计时,但是随着c ++逐行行动,我得到了我想要的东西。我希望倒计时与测试同时进行。



我的尝试:



这里是我的程序的一部分



I am currently making a quiz program. And I created a countdown, but as c++ does actions line by line I am getting what I want. I want countdown work simultaneously with the tests.

What I have tried:

here is the one part of my program

void QUIZ::OOP2()
{
	system("cls");
	QUIZ("OOP2");
	int oop2_time = 100;
	for (int i = oop2_time; oop2_time >= 0; i--)
	{
		cout << "\t\t\tQuestions of OOP2\n\n";
		line();
		cout << "1.	Evaluate !(1 && !(0 || 1)) \n";
		line();
		cout << "A)True \t B) False \t C)Error\t D)None of these\n";

		CorrectA(var);

		_getch(); system("cls"); line();
		cout << "2.Cout<<((4*2/2)%2); will display\n";
		line();
		cout << "a) 4    b) 2      c) 0     d)  1\n";

		CorrectC(var);

		_getch(); system("cls"); line();
		cout << "3.___________ is a NOT a valid identifier     \n";
		line();
		cout << "  a)  num2   b) while        c) my_number  d) INT \n";

		CorrectB(var);

		_getch(); system("cls"); line();
		cout << "4.The precedence of athematic operators is (highest to lowest from left to right)?  \n";
		line();
		cout << "	a) %,  *, / , +    b). *, +, /,%     c).  %, +, *,  /    d). %, *, +, / \n";

		CorrectB(var);

		_getch(); system("cls"); line();
		cout << "5. Which operator has the highest priority (precedence) \n";
		line();
		cout << " a)  *         b)  +          c) ( )   d) /  \n";

		CorrectA(var);

		_getch(); system("cls"); line();
		cout << "6.The keyword "default "  can be written anywhere in switch block \n";
		cout << "   a)  True       b)  False \n";
		line();

		CorrectA(var);

		_getch(); system("cls"); line();
		cout << "7. Break statement is used for \n";
		line();
		cout << "  a). Quit the current block   b)  Quit a program  c) return 0    d) None    \n";

		CorrectA(var);

		_getch(); system("cls"); line();
		cout << "8.int k=‘K’;  cout << k ;  will display        \n";
		line();
		cout << "    a) K        b)  ASCII code of K               c) k           d)    garbage value  \n";

		CorrectB(var);

		_getch(); system("cls"); line();
		cout << "9.  The program that translates high-level language program into object code       is called  \n";
		line();
		cout << "	 a) Editor   b) Assembler         c) Decoder    d) Compiler  \n";

		CorrectD(var);

		_getch(); system("cls"); line();
		cout << "10.  If you are required to declare a variable to store the marks of a student in OOP subject (Min 0~ Max 100), which data type will you choose to use the memory efficiently?     \n";
		line();
		cout << " a)  short    b) unsigned int   c) float   d) int    \n";

		CorrectA(var);

		_getch(); system("cls"); line();
		cout << "11. Switch selection structure can be used to represent any kind of if-else selection structure?     \n";
		line();
		cout << "    a)   True         b) False  \n";

		CorrectB(var);
		if (oop2_time == 100)
		{
			cout << "You have the remaining" << oop2_time << "seconds \n" << endl;
			Sleep(40000);
		}
		if (oop2_time == 60)
		{
			cout << "You have the remaining" << oop2_time << "seconds \n" << endl;
			Sleep(30000);
		}
		if (oop2_time == 30)
		{
			cout << "You have the remaining" << oop2_time << "seconds \n" << endl;
			Sleep(15000);
		}
		if (oop2_time == 15)
		{
			cout << "You have the remaining" << oop2_time << "seconds \n" << endl;
			Sleep(10000);
		}
		if (oop2_time == 5)
		{
			cout << "You have the remaining" << oop2_time << "seconds \n" << endl;
			Sleep(5000);
			cout << "\nTime is out\n";
			goback();
			intro();
		}

		result("OOP2");
		goback();
	}
}

推荐答案


这篇关于倒计时可以在后台工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 05:07