/************************************************** *** Assignment 1.26 - lab one by Dustin Luca *** *** *** *** Lab assignment - create a C++ program that *** *** takes in the values of 3 whole numbers *** *** and prints the numbers, sum, average, *** *** and product. ALso, the program must *** *** recognize the smallest and largest of *** *** the three numbers... *** *** Last updated - 9-9-2003 *** **************************************************/ #include int mainlab() { int number1, number2, number3; int sum, average, product; // these next lines cover the input of the three integers std::cout << "\n\n\n\n\n\nNow you can enter numbers, WHOLE #'s ONLY\nEnter first number: "; std::cin >> number1; // places number on integer number1 std::cout << "Enter second number: "; std::cin >> number2; // places number on integer number2 std::cout << "Enter third number: "; std::cin >> number3; // places number on integer number3 std::cout << "\nYou entered: " << number1 << ", " << number2 << ", and " << number3 << std::endl; // do the math sum = number1 + number2 + number3; average = (number1 + number2 + number3) / 3; product = number1 * number2 * number3; // print the results of the math equations seen above std::cout << "The sum of the numbers is: " << sum << std::endl; std::cout << "The average of the three is: " << average << std::endl; std::cout << "The product of the three numbers is " << product << std::endl; // determine the smallest and largest of the numbers...lots of if statements if (number1 < number2 && number1 < number3) std::cout << number1 << " is the smallest number (number 1)" << std::endl; else if (number2 < number1 && number2 < number3) std::cout << number2 << " is the smallest number (number 2)" << std::endl; else std::cout << number3 << " is the smallest number (number 3)" << std::endl; if (number1 > number2 && number1 > number3) std::cout << number1 << " is the largest number (number 1)" << std::endl; else if (number2 > number1 && number2 > number3) std::cout << number2 << " is the largest number (number 2)" << std::endl; else std::cout << number3 << " is the largest number (number 3)" << std::endl; return 0; } //end of program