I just start to study c++. I'm reading Deitel&Deitel 8th Edition. There are questions after chapter. I solved many of them. But I cant solved this one:
"(Arithmetic, Smallest and Largest) Write a program that inputs three integers from the keyboardandprints the sum, average, product, smallest and largest of these numbers. Use only the programming techniques you learned in this chapter."
I have learned "<, >, >=, <=, !=, ==, =, if, % and only int numbers" so i must solve this problem by these operators and statements. I tried to do something like this:
#include <cstdlib>
#include <iostream>
using std::cout;
using std::cin;
int main(int argc, char *argv[])
{
int x;
int y;
int z;
int f;
int g;
cout << " Please give me 3 number to compare : " ;
cin >> x >> y >> z ;
cout << "Sum:" << x + y + z ;
cout << "Product:" << x*y*z ;
cout << " Average: " << (x+y+z)/ 3 ;
f=x%y;
g=y%x;
cout<< f ;
if (f < 1)
cout << "1. is the smallest number.\\n" ;
if (g < 1 )
cout<< "2. number is smallest.\\n";
system("PAUSE");
return EXIT_SUCCESS;