Click here to Skip to main content
15,889,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Memory leak in this case? Pin
George_George21-Mar-08 0:55
George_George21-Mar-08 0:55 
AnswerRe: Memory leak in this case? Pin
Nemanja Trifunovic21-Mar-08 6:49
Nemanja Trifunovic21-Mar-08 6:49 
GeneralRe: Memory leak in this case? Pin
George_George21-Mar-08 20:46
George_George21-Mar-08 20:46 
AnswerRe: Memory leak in this case? Pin
peterchen21-Mar-08 9:38
peterchen21-Mar-08 9:38 
GeneralRe: Memory leak in this case? Pin
George_George21-Mar-08 20:39
George_George21-Mar-08 20:39 
Questionhow to embedd a manifest file to vc++ 6.0 Pin
vicky0000020-Mar-08 22:00
vicky0000020-Mar-08 22:00 
AnswerRe: how to embedd a manifest file to vc++ 6.0 Pin
bob1697221-Mar-08 2:34
bob1697221-Mar-08 2:34 
GeneralRandomizing in c++ [modified] Pin
zanderela20-Mar-08 20:18
zanderela20-Mar-08 20:18 
hi i wrote a trivia program but i want to improve it by randomizing the questions in it. but how do i do it? thanksBig Grin | :-D Smile | :)

<br />
main()<br />
{<br />
	int l;<br />
	clrscr();<br />
	gotoxy(30,7);printf("[1] QUESTIONS\n");<br />
	gotoxy(30,9);printf("[2] QUIT\n\n");<br />
	gotoxy(30,13);printf("Choose:  ");<br />
	scanf("%d",&l);<br />
	if(l==1)<br />
	easy();<br />
	else if(l==2)<br />
	exit();<br />
	}<br />
easy()<br />
{<br />
	int x;<br />
	char d[5];<br />
	int i=0;<br />
	char a[]="a";<br />
	char b[]="b";<br />
	char c[]="c";<br />
	for(x=0;x<=3;x++)<br />
	{<br />
	clrscr();<br />
	gotoxy(10,5);printf("Direction: Choose the letter of the correct answer.");<br />
	gotoxy(10,7);printf("1. What two letters are both symbols for 1,000?");<br />
	gotoxy(10,9);printf("%s. K and M.",a);<br />
	gotoxy(10,11);printf("%s. A and B.",b);<br />
	gotoxy(10,13);printf("%s. L and D",c);<br />
	gotoxy(10,15);printf("Answer: ");gets(d);<br />
	if(strcmp(d,a)==0)<br />
	{<br />
	gotoxy(12,20);printf("Correct!!!\n");<br />
	i=i+1;<br />
	gotoxy(12,21);printf("Your score is %d",i);<br />
	x=3;<br />
	getch();<br />
	}<br />
	if(strcmp(d,a)!=0)<br />
	{<br />
	gotoxy(12,20);printf("Wrong!!!\n");<br />
	gotoxy(12,21);printf("Life[%d]",x);<br />
	getch();<br />
	if(x>=3)<br />
	{<br />
	main();<br />
	}<br />
	}<br />
	}<br />
	for(x=1;x<=3;x++)<br />
	{<br />
	clrscr();<br />
	gotoxy(10,7);printf("2. What's short for Binary Digit?");<br />
	gotoxy(10,9);printf("%s. BD.",a);<br />
	gotoxy(10,11);printf("%s. Bit.",b);<br />
	gotoxy(10,13);printf("%s. Digit.",c);<br />
	gotoxy(10,15);printf("Answer: ");gets(d);<br />
	if(strcmp(d,b)==0)<br />
<br />
	{<br />
	gotoxy(12,20);printf("Correct!!!\n");<br />
	i=i+1;<br />
	gotoxy(12,21);printf("Your score is %d",i);<br />
	x=3;<br />
	getch();<br />
	}<br />
	else<br />
	{<br />
	gotoxy(12,20);printf("Wrong!!!\n");<br />
	gotoxy(12,21);printf("Life[%d]",x);<br />
	getch();<br />
	if(x>=3)<br />
	{<br />
	main();<br />
	}<br />
	}<br />
	}<br />
	for(x=1;x<=3;x++)<br />
	{<br />
	clrscr();<br />
	gotoxy(10,7);printf("3. What digit did Arab mathematician al-Khwarizmi give to the West\n            around 800 B/B.?");<br />
	gotoxy(10,10);printf("%s. Zero",a);<br />
	gotoxy(10,12);printf("%s. One",b);<br />
	gotoxy(10,14);printf("%s. Two",c);<br />
	gotoxy(10,16);printf("Answer: ");gets(d);<br />
	if(strcmp(d,a)==0)<br />
<br />
	{<br />
	gotoxy(12,20);printf("Correct!!!\n");<br />
	i=i+1;<br />
	gotoxy(12,21);printf("Your score is %d",i);<br />
	x=3;<br />
	getch();<br />
	}<br />
	else<br />
	{<br />
	gotoxy(12,20);printf("Wrong!!!\n");<br />
	gotoxy(12,21);printf("Life[%d]",x);<br />
	getch();<br />
	if(x>=3)<br />
	{<br />
	main();<br />
	}<br />
	}<br />
	}<br />
	for(x=1;x<=3;x++)<br />
	{<br />
	clrscr();<br />
	gotoxy(10,7);printf("4. What word describes a number system with a base of two?");<br />
	gotoxy(10,9);printf("%s. Decimal",a);<br />
	gotoxy(10,11);printf("%s. Octal",b);<br />
	gotoxy(10,13);printf("%s. Binary",c);<br />
	gotoxy(10,15);printf("Answer: ");gets(d);<br />
	if(strcmp(d,c)==0)<br />
<br />
	{<br />
	gotoxy(12,20);printf("Correct!!!\n");<br />
	i=i+1;<br />
	gotoxy(12,21);printf("Your score is %d",i);<br />
	x=3;<br />
	getch();<br />
	}<br />
	else<br />
	{<br />
	gotoxy(12,20);printf("Wrong!!!\n");<br />
	gotoxy(12,21);printf("Life[%d]",x);<br />
	getch();<br />
	if(x>=3)<br />
	{<br />
	main();<br />
	}<br />
	}<br />
	}<br />
	for(x=1;x<=3;x++)<br />
	{<br />
	clrscr();<br />
	gotoxy(10,7);printf("5. How many equal sides does an icosahedron have?");<br />
	gotoxy(10,9);printf("%s. Ten",a);<br />
	gotoxy(10,11);printf("%s. Twenty",b);<br />
	gotoxy(10,13);printf("%s. Thirty",c);<br />
	gotoxy(10,15);printf("Answer: ");gets(d);<br />
	if(strcmp(d,b)==0)<br />
<br />
	{<br />
	gotoxy(12,20);printf("Correct!!!\n");<br />
	i=i+1;<br />
	gotoxy(12,21);printf("Your score is %d",i);<br />
	x=3;<br />
	getch();<br />
	}<br />
	else<br />
	{<br />
	gotoxy(12,20);printf("Wrong!!!\n");<br />
	gotoxy(12,21);printf("Life[%d]",x);<br />
	getch();<br />
	if(x>=3)<br />
	{<br />
	main();<br />
	}<br />
	}<br />
	}<br />
<br />
}<br />


modified on Friday, March 21, 2008 2:27 AM

QuestionRe: Randomizing in c++ Pin
CPallini20-Mar-08 21:56
mveCPallini20-Mar-08 21:56 
GeneralRe: Randomizing in c++ Pin
Rajesh R Subramanian20-Mar-08 22:44
professionalRajesh R Subramanian20-Mar-08 22:44 
GeneralRe: Randomizing in c++ Pin
CPallini20-Mar-08 23:05
mveCPallini20-Mar-08 23:05 
GeneralRe: Randomizing in c++ Pin
toxcct20-Mar-08 23:40
toxcct20-Mar-08 23:40 
GeneralRe: Randomizing in c++ Pin
Capitanevs21-Mar-08 2:18
Capitanevs21-Mar-08 2:18 
GeneralRe: Randomizing in c++ Pin
David Crow21-Mar-08 3:34
David Crow21-Mar-08 3:34 
QuestionNeed help on outlook addin Pin
manish.patel20-Mar-08 19:23
manish.patel20-Mar-08 19:23 
Generalerror C2668: 'sqrt' : ambiguous call Pin
gentleguy20-Mar-08 17:29
gentleguy20-Mar-08 17:29 
GeneralRe: error C2668: 'sqrt' : ambiguous call Pin
Mark Salsbery20-Mar-08 17:42
Mark Salsbery20-Mar-08 17:42 
Generalauto_ptr compile error Pin
George_George20-Mar-08 16:59
George_George20-Mar-08 16:59 
QuestionRe: auto_ptr compile error Pin
Rajkumar R20-Mar-08 22:55
Rajkumar R20-Mar-08 22:55 
GeneralRe: auto_ptr compile error Pin
George_George20-Mar-08 23:40
George_George20-Mar-08 23:40 
GeneralRe: auto_ptr compile error Pin
Rajkumar R21-Mar-08 0:14
Rajkumar R21-Mar-08 0:14 
GeneralRe: auto_ptr compile error Pin
George_George21-Mar-08 0:27
George_George21-Mar-08 0:27 
GeneralRe: auto_ptr compile error Pin
Rajkumar R21-Mar-08 0:31
Rajkumar R21-Mar-08 0:31 
GeneralRe: auto_ptr compile error Pin
George_George21-Mar-08 0:46
George_George21-Mar-08 0:46 
GeneralRe: auto_ptr compile error [modified] Pin
Rajkumar R21-Mar-08 1:19
Rajkumar R21-Mar-08 1:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.