I'm
Code:// 1 .cpp // // Write a program that inputs three integers from the keyboards and prints the sum, average, // product, smallest and largest of these numbers. // // The screen dialog should appear as follows: // Input three different integers: 13 27 14 // Sum is 54 // Average is 18 // Product is 4914 // Smallest is 13 // Largest is 27 // Include preprocessing directive as done below: #include <iostream> // Include all of the other yummy crap below using std::cout; using std::cin; using std::endl; // Remember to always start the actual program with function "main()" int main() { cout << "Input your three numbers: "; int a; int b; int c; int all; cin >> a >> b >> c; all = a + b + c; cout << "\nThe sum of your three integers is " << all << "\n"; all = (a + b + c) / 3; cout << "The average of your three integers is " << all << "\n"; all = a * b * c; cout << "The product of your three integers is " << all << "\n"; if (a < b && a < c) cout << "Out of the three integers that you input " << a << " is the smallest of them all\n"; if (b < a && b < c) cout << "Out of the three integers that you input " << b << " is the smallest of them all\n"; if (c < a && c < b) cout << "Out of the three integers that you input " << c << " is the smallest of them all\n"; if (a == b) cout << "Out of the three integers that you input " << a << " and " << b << " are tied for being the smallest numbers\n"; if (a == c && a != b) cout << "Out of the three integers that you input " << a << " and " << c << " are tied for being the smallest numbers\n"; if (b == c && b != a) cout << "Out of the three integers that you input " << b << " and " << c << " are tied for being the smallest numbers\n"; if ( a == b && b == c) cout << "All of the numbers that you have entered are the exact same!, or there is an error!\n"; cin >> a; return 0; }
I'm learning this stuff out of a book. It's asking me tell the user which integer out of the three that they input which is smallest. Is there a math equation to find out which of the three numbers is the smallest because it says not to use anything not mentioned in the chapterI'm not even suppose to use &&




I'm not even suppose to use &&
Reply With Quote