/* geology.cpp: A program to model rocks * * ------ Add full documentation ------ *************************************************************************/ #include using namespace std; // Represent each rock by a number const int BASALT = 0; const int DOLOMITE = 1; const int GRANITE = 2; const int LIMESTONE = 3; const int MARBLE = 4; const int OBSIDIAN = 5; const int QUARTZITE = 6; const int SANDSTONE = 7; const int ROCK_OVERFLOW = 8; // Function prototypes go here // Main function here int main() { /***** PART 1 ******/ // Declare a variable to store a rock int sample; // Input and display various rocks for(;;) { cout << "Enter a rock name (" << ROCK_OVERFLOW << " to stop): "; cin >> sample; if (sample == ROCK_OVERFLOW) break; cout << "Rock is: " << sample << endl; } /***** PART 2 ******/ // Display all the rock names cout << "\nList of rock names:\n"; for (int rockVal = BASALT; rockVal <= SANDSTONE; rockVal++) cout << rockVal << " "; cout << endl; }