Guessing Game In C
This is a small guessing game written in C. In this guessing game you have to guess a number between 0 & 100. You have 8 chances to do that. Every time you guess wrongly the program will give you a hint that your guess is too high or your guess is too low. Based on this hint you have to guess the number in the remaining attempts. Here’s the code
#include<stdlib.h>
#include<time.h>
void main()
{
int num,guess=-1,tries=0,pass=0;
time_t t;
srand((unsigned)time(&t));
num=rand()%100;
while((guess!=num)&&tries<8)
{
printf(“Enter the guess num b/w 0 & 100 (you have %d tries left out)\n”,(8-tries)); scanf(“%d”,&guess);
tries++;
if(guess==num)
{
printf(“Hurray you guessed it correctly!!!\n”);
pass=1;
}
else if(num< guess)
printf(“Your guess is too high\n”);
else
printf(“Your guess is too low\n”);
}
if(pass==0)
printf(“Sorry you lost! The correct number is %d\n”,num);
}
Popularity: 1% [?]
By using/following this site you agree to our Legal Disclaimer


THis actually worked. I have been working on this project for a simple game program and could not figure out what i was doing wrong. I am using Miracle C compiler and thought it was the compiler but soem of the code ideas here helped me to identify my issues. Thanks
that’s good
yea but what about for complete beginners, im guessing past in ntoepad save as “blabla.c”? or .exe i have no idea?!? help me!
hi srikant u r superb.
this really helps me a lot.
hi srikanth its really superb……..
i am inspired by you that now i’m intresting to knw abt hack something blabla….. till now i have no idea to study abt anything
but after visiting ur site,it inspire for getting to know abt something abt hack ………. thanks u re really well…………..
your guidance is useful for everyone……thanks hats off……
hi Srikanth !! u r the undisputed man !! but am real a beginer and i wanna know !! so should i
copy this copy this source code into the note pad and the wat follows…please!! help me
Leave your response!
EMAIL SECURITY »
What to do when your Email Account is Hacked?
How to Recover Hacked Email Accounts?
It can be a real nightmare if someone hacks and takes control of your email account as it may contain confidential information like bank logins, credit card details and other sensitive data. …
HOW-TO GUIDES »
How to Detect Anonymous IP Addresses
As the fraudsters are now becoming more sophisticated in bypassing the Geo-location controls by using proxies (Anonymous IPs) to spoof their IP address, it has become very much necessary to come up with a means …
INTERNET SECURITY »
How to Detect Anonymous IP Addresses
As the fraudsters are now becoming more sophisticated in bypassing the Geo-location controls by using proxies (Anonymous IPs) to spoof their IP address, it has become very much necessary to come up with a means …
NETWORK HACKS »
How to Hack an Ethernet ADSL Router
Almost half of the Internet users across the globe use ADSL routers/modems to connect to the Internet however, most of them are unaware of the fact that it has a serious vulnerability which can easily be exploited even by a …
VIRUS CREATION »
How to Test the Working of your Antivirus – EICAR Test
Have you ever wondered how to test your Antivirus software to ensure it’s proper working? Well here is a quick and easy way to test your antivirus. The process is called EICAR test which will …
Categories
Blogroll
Recent Comments
Most Commented
Most Popular
Log In | Entries (RSS) | Comments (RSS) | Sitemap