I made this simple game code. Can you please give me some advice about how can I improve it ? I thought about making the screen blue and the letters yellow can someone explain me how to do that ?
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include <time.h>
#include <windows.h>
void main ()
{
printf("\t\tWelcome to our gessing game\n\n\n");
printf("the computer choose a random number between 1-99, try to gess the random number...");
srand(time(NULL));
int gess,i=0,found=0, r = rand()%100;
while (i<10 && found==0)
{
printf("\n My gess is:\t");
scanf("%d",&gess);
if (gess==r)
{
found=1;
i++;
}
else if(gess>r)
{
printf("\n Too big\n");
i++;
}
else if(gess<r)
{
printf("\n Too small\n");
i++;
}
}
if (found==1&&gess==1)
printf("\n Very good the number is %d this is your %dst gess",gess,i);
else if(found==1&&gess==2)
printf("\n very good the number is %d this is your %dnd gess",gess,i);
else if(found==1&&gess==3)
printf("\n very good the number is %d this is your %drd gess",gess,i);
else if(found==1&&gess!=1&&gess!=2&&gess!=3)
printf("\n very good the number is %d this is your %dth gess",gess,i);
else
printf("\n Never mind try again");
getch();
}
if
against the left side). Its hard to read code at the best of times try not to make it harder with bad formatting. – Loki Astari Mar 9 at 17:39