קוד:#include <stdio.h>#include <stdlib.h> #include <time.h> int main () { int choice,num1; srand(time(NULL)); printf ("Welcome to the ONE TO TEN number guess! \nplease pick a number between 1 to 10, type it and press Enter. \n"); scanf ("%d,&choice"); if ((choice>0)&&(choice<11)) { int num1=rand()%10; if (num1=choice) { printf ("Congratulations, you won the game \n"); } else { printf ("Sorry, you lost \n"); } } else { printf ("You chose a wrong number\n"); } return 0; }
זה עובד לי בעיקרון אבל כשרושמים מספר בין 1 ל-10 זה אומר לי Sorry,you lost ומסתיים כאילו בחרתי מספר שלא בין 1 ל- 10.. למה?



ציטוט ההודעה


