Monday, May 24, 2010

NEED BADLY!!need tommorow please help me..turbo c problem?

#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


main()


{


char W;


int A,H;


clrscr();


printf("What is the name of my school?");


printf("a.La Salle,b.UST,c.UE,d.UP");


scanf("%c",%26amp;W);


if(W-'a')


{


printf("Correct!!!\n");


A=0


H=A+1


printf("Your Score is %i",H);


}


else


{


printf("Wrong\n");


}


getch();


return 0;


}





please help me...else function doesn't work ..please i need it tommorow ASAP..tnx!!


really apprecitate it

NEED BADLY!!need tommorow please help me..turbo c problem?
If the correct answer is "a", then your test needs to be


if (W == 'a')





Your current code will score b,c and d as correct, but not a.
Reply:u didn't mention what error u r getting? always mention error while asking for help.


i think the error is at line


if(W-'a')


it shd be


if(W=='a')


try it... and then compile....
Reply:remove clrscr() and try to compile n run this code





#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


main()


{


char W;


int A,H;





printf("What is the name of my school?");


printf("a.La Salle,b.UST,c.UE,d.UP");


scanf("%c",%26amp;W);


if(W-'a')


{


printf("Correct!!!\n");


A=0;


H=A+1;


printf("Your Score is %i",H);


}


else


{


printf("Wrong\n");


}


getch();


return 0;


}


No comments:

Post a Comment