/* testfunc06.cpp CIS 150 2008-06-10 David Klick This program demonstrates how to create a die rolling simulator that rolls two dice at a time (useful for games like craps). */ #include #include #include #include using std::cin; using std::cout; int roll(); // function prototype int roll2(); // function prototype void cont(); int main(int argc, char* argv[]) { int numrolls; // how many times to roll the die int i; // loop counter // initialize random number generator srand(time(0)); // find out how many rolls the user wants cout << "How many rolls? (0 - 100) "; cin >> numrolls; // end program if user entered something invalid if (numrolls<0 || numrolls>100) { cout << "Error: Invalid number of rolls\n"; return(1); } // generate and display rolls of dice for (i=0; isungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); }