OK, here is my c++ program that i made with "Visual C++ 2005 Express Edition"....
#include<cstdlib>
#include<ctime>
#include<iostream>
using namespace std;
int main()
{
cout << "Welcome To Danny's Game!.\n";
cout << "See if you can beat me.\n";
cout << "The First number below is your number.\n";
srand((unsigned)time(0));
int random_integerplayer;
for(int index=0; index<1; index++)
{
random_integerplayer = (rand()%10)+1;
cout << random_integerplayer << endl;
cout << "\n";
cout << "This is my number.\n";
srand((unsigned)time(0));
int random_integercomputer;
for(int index=0; index<1; index++)
{
random_integercomputer = (rand()%10)+1;
cout << random_integercomputer << endl;
cout << "\n";
if( random_integercomputer>=random_integerplayer )
cout << "You Lose. ";
else
cout << "You Win! ";
}
}
}
OK, that was my code, but something won't work.
Whenever i use it, it always comes up with 2(two)
numbers(computer and player), that are both exactully the same!!!
Please help me make it so that when it generates the random numbers, they are both different...
thxz alot! =)