I tried making a program that "rolls" dice... But for some reason it only loops three times and it quits....
This is in C++ btw...
it's supposed to generate random dice numbers till it reaches 5 rolls of 8 and display how many
#include <iostream.h>
#include <stdib.h>
#include <stdio.h>
#include <time.h>
int main(){
int i;
srand( (unsigned)time( NULL ) );
int die1;
int die2;
int total;
int x = 0;
int counter = 0;
cout << "Die 1ttDie 2ttTOTALn---------------------n";
for(i = 1; i > 0; i++) {
x++;
counter++;
die1 = rand()%7;
die2 = rand()%7;
//total = die1+die2;
// Ifs..... lol
cout << die1 << "tt" << die2 << "tt" << die1+die2 << endl;
if(die1+die2 <= 8) {
counter++;
}
if(counter == 5) {
break;
}
}
cout << "aIt took " << x << " rolls to produce 5 rolls of 8.";
}
Aqua-Soft Forums