/* The fortune Teller - * a simple program introducing some * fundimental programming concepts. */ #include // include a library using namespace std; int main() // main() starts the program { // -------------- Variable Declarations ------------------ int favorite; // create a variable to store the favorite number int disliked; // create a variable to store the disliked number int lucky; // create a variable to store the lucky number // ------------- Get user input ------------------------- cout << "Enter your favorite number (no decimals): "; // output cin >> favorite; // user input cout << "Enter a number you don't like (no decimals): "; cin >> disliked; lucky = (favorite*disliked) % 10; cout << endl << "Your secret, lucky number is: " << lucky << endl; if(lucky < 0){ // conditional, calues less than 0 cout << "Try to be less negative." << endl; } if(lucky >= 0 && lucky < 5){ // 0 to 4 inclusive cout << "Think bigger!" << endl; } if(lucky >= 5 && lucky < 9){ // 5 to 8 inclusive cout << "Today you should embrace technology." << endl; } if(lucky == 9){ // exactly 9 cout << "Today is your lucky day!" << endl; } // ---------- Code to help the program exit "gracefully" ----- cin.ignore(); cout << "Press enter to quit." << endl; cin.ignore(); return 0; }