Hey, Ive been doing some c language at school but it was to do with microprocessors, anyway Im wondering if its possible to compile my code into .exe excutable so Windows command window could be used. I know C++ can I think from memory but Im really unsure could someone point me into a direction on how or what to read? Below is my code
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int minNum=0;
int maxNum=100;
srand ( time(NULL) );
int num=rand()%100;
int count=0;
int guessNum;
printf("Number Guessing Game\n\n");
printf("Guess a number between 0 to 100\n");
while(1)
{
scanf("%d",&guessNum);
if (guessNum != num && guessNum > num && guessNum<=100) {
printf("The number is between %d to %d\n",minNum,guessNum);
maxNum=guessNum;
count++;
}
else if(guessNum != num && guessNum < num) {
printf("The number is between %d to %d\n ",guessNum,maxNum);
minNum=guessNum;
count++;
}
else if(guessNum >100){
printf("Please enter a value within the range %d is not within the range of 0-100\n",guessNum);
}
else if(guessNum==num){
count++;
break;
}
}
if (count==1) {
printf("YOU WON! the number is %d took you %d guess\n",num,count);
}
else{
printf("YOU WON! the number is %d took you %d guesses\n",num,count);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int minNum=0;
int maxNum=100;
srand ( time(NULL) );
int num=rand()%100;
int count=0;
int guessNum;
printf("Number Guessing Game\n\n");
printf("Guess a number between 0 to 100\n");
while(1)
{
scanf("%d",&guessNum);
if (guessNum != num && guessNum > num && guessNum<=100) {
printf("The number is between %d to %d\n",minNum,guessNum);
maxNum=guessNum;
count++;
}
else if(guessNum != num && guessNum < num) {
printf("The number is between %d to %d\n ",guessNum,maxNum);
minNum=guessNum;
count++;
}
else if(guessNum >100){
printf("Please enter a value within the range %d is not within the range of 0-100\n",guessNum);
}
else if(guessNum==num){
count++;
break;
}
}
if (count==1) {
printf("YOU WON! the number is %d took you %d guess\n",num,count);
}
else{
printf("YOU WON! the number is %d took you %d guesses\n",num,count);
}
return 0;
}