#include<iostream.h>
#include<time.h>
#include <stdlib.h>
#include<conio.h>
void main()
{
srand (time(NULL));
int guss,ans,count=1;
ans=rand() % 10+1;
cout<<"Guss the number in the range of 1 to 10\n";
do
{
cin>>guss;
if (guss>ans){
cout<<"Too big number try smaller number\n";
count++;
}
else if(guss<ans){
cout<<"Too smaller number try biger number\n";
count++;
}
else if (guss==ans){
cout<<"congragulation you guss right number in "<<count<<" attempt\n";
}
}
while(guss!=ans && count !=4);
getch();
}
#include<time.h>
#include <stdlib.h>
#include<conio.h>
void main()
{
srand (time(NULL));
int guss,ans,count=1;
ans=rand() % 10+1;
cout<<"Guss the number in the range of 1 to 10\n";
do
{
cin>>guss;
if (guss>ans){
cout<<"Too big number try smaller number\n";
count++;
}
else if(guss<ans){
cout<<"Too smaller number try biger number\n";
count++;
}
else if (guss==ans){
cout<<"congragulation you guss right number in "<<count<<" attempt\n";
}
}
while(guss!=ans && count !=4);
getch();
}
not a easy code......
ReplyDeleteok i wil upload another 1 .........hope u like it......
ReplyDelete