OK, so I was making some program on Dev C++, and I made it about guessing the number of cookies in a cookie jar...I told it to pick a random number, and it always chooes 6!!! You know what, here's the code..( I made it really badly, I didn't feel like putting work into it :))
:
#include<iostream>
using namespace std;
int main()
{
system("TITLE COOKIE JAR GUESSING GAME");
system("COLOR 2");
int icookies;
int ijar;
int iguess;
srand((unsigned int)icookies);
icookies = rand()%10+1;
cout<<"guess how many cookies are in the jar"<<endl;
cin>>iguess;
if (iguess< icookies) {
cout<<"too low"<<endl;
}
if (iguess == icookies){
cout<<"you win!"<<endl;
}
if (iguess > icookies) {
cout<<"too high" << endl;
}
cin>>iguess;
if (iguess< icookies) {
cout<<"too low"<<endl;
}
if (iguess == icookies){
cout<<"you win!"<<endl;
}
if (iguess > icookies) {
cout<<"too high" << endl;
}
cin>>iguess;
if (iguess< icookies) {
cout<<"too low"<<endl;
}
if (iguess == icookies){
cout<<"you win!"<<endl;
}
if (iguess > icookies) {
cout<<"too high" << endl;
}
system("PAUSE");
return(0);
}