#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
main()
{
int A,B,C,D,X;
clrscr();
printf("FIRST QUESTION 1+1=?);
printf("CHOICES A.2,B.3,C.4,D.5");
scanf("%i,%26amp;A);
if(A = ='A')
{
printf("Correct!!!")
}
else
{
printf("Wrong")
}
it doesn't work the way i want to..please help me..im just a 13 yr old..can anybody lend me a hand?thanks...
Can somebody help me?please correct my errors (Turbo C)?
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
main()
{
int ans;
clrscr();
printf("FIRST QUESTION 1+1=?);
printf("CHOICES A.2,B.3,C.4,D.5");
ans = getchar();
if (ans=='A' || ans=='a')
{
printf("Correct!!!")
}
else
{
printf("Wrong")
}
return 0;
}
Reply:You should either do a strcmp() or compare if(A==1) since you have A declared as an integer (and read in that way) but comparing it to a character. Unless you are looking to compare ASCII values... Also, you are missing an ending " in your FIRST QUESTION printf() statement.
And as matter of style, your main() function should return something or mark its return as void. And use useful variable names...
Reply:printf("FIRST QUESTION 1+1=?);
scanf ("%i,%26amp;A")
Dont give them a choice if you do, make it just
printf("CHOICES 2, 3, 4, 5");
A2 B3...its confusing huh?
int A=0;
int a=2;
/*int b=3;
int c=4;
int d=5; aren't being used yet*/
So you get a number.
Then
if( A==a)//compare their answer to your variable
Reply:put it on desktop reset windows
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment