// Roman Numeral Test Program #include #include #include #include using namespace std; typedef int roman; // Include Roman numeral class instead int main(int argc, char *argv[]) { roman a; int i; // First 100 numerals cout << "Count to 100" << endl; for (i=1; i <=100; i++) { a = roman(i); //modify if necessary cout << setw(10) << a; if ((i % 5) == 0) cout << endl; } roman list[10]; for (i=0; i<10; i++) list[i] = roman( rand() % 100 + 1 ); // Random # between 1 and 100 cout << endl << "Random Number List" << endl; for (i=0; i<10; i++ ) cout << setw(2) << i << " - " << list[i] << endl; cout << endl << "Find Largest: " << endl; int maxidx = 0; for (i=1; i<10; i++ ) { if (list[i] > list[maxidx] ) maxidx = i; } cout << list[maxidx] << " @ index " << maxidx << endl; cout << endl << "Total of Random Values: " << endl; roman total; total = 0; //Modify if necessary int totalint; for (i=0; i<10; i++ ) { total += list[i]; } totalint = int(total); // Modify if necessary cout << total << " which is " << totalint << " for you NON-Romans!" << endl; system("PAUSE"); return EXIT_SUCCESS; }