A simple game program:guess my number

atikbabu

Member
Reputation
0
#include <stdio.h>
#include <time.h>
#include <stdlib.h>


int main(void) {
int mine = 0;
int yours = 0;


srand(time(NULL));
mine = 1 + rand() % 10;


printf("Guess my number, 1 - 10: ");
scanf("%d", &yours);


if(yours < mine)
printf("Your guess was to low\n");

else if(yours > mine)
printf("Your guess was to high\n");

else
printf("Yesss ... you got it!\n");

printf("The correct number was, %d\n", mine);

return 0;
}
 
#include <stdio.h>
#include <time.h>
#include <stdlib.h>


int main(void) {
int mine = 0;
int yours = 0;


srand(time(NULL));
mine = 1 + rand() % 10;


printf("Guess my number, 1 - 10: ");
scanf("%d", &yours);


if(yours < mine)
printf("Your guess was to low\n");

else if(yours > mine)
printf("Your guess was to high\n");

else
printf("Yesss ... you got it!\n");

printf("The correct number was, %d\n", mine);

return 0;
}
 
#include <stdio.h>
#include <time.h>
#include <stdlib.h>


int main(void) {
int mine = 0;
int yours = 0;


srand(time(NULL));
mine = 1 + rand() % 10;


printf("Guess my number, 1 - 10: ");
scanf("%d", &yours);


if(yours < mine)
printf("Your guess was to low\n");

else if(yours > mine)
printf("Your guess was to high\n");

else
printf("Yesss ... you got it!\n");

printf("The correct number was, %d\n", mine);

return 0;
}
 
Uhm? I have no idea what this is... Any explanations?
 
^^ yeah same kind of lost? guessing he does /# (example) and it says that stuff. bot ftw?
 
^^ yeah same kind of lost? guessing he does /# (example) and it says that stuff. bot ftw?
 
I didnt really understand this program.. explain more dont just post the code :S
 
I didnt really understand this program.. explain more dont just post the code :S
 
you have lost me there hehe.. i dont understand the code.. more info. about this please :)
 
you have lost me there hehe.. i dont understand the code.. more info. about this please :)
 
I can't get anything, is it some kind of joke sorry man need to more explanations for that, simple way so that I can get everything instead of a confusing way.
 
I can't get anything, is it some kind of joke sorry man need to more explanations for that, simple way so that I can get everything instead of a confusing way.
 
No, that code is actually JAVA and yea it works though I think it is probably a basic code that beginner can actually do, but well thanks for the share.
 
No, that code is actually JAVA and yea it works though I think it is probably a basic code that beginner can actually do, but well thanks for the share.
 
Back
Top