Based on : Cprogramming.com Tutorial: Functions
Code:
#include <iostream>
using namespace std;
int mult ( int x, int y );
int main()
{
int x;
int y;
cout<<"Please input two numbers to be multiplied: ";
cin>> x >> y;
cin.ignore();
cout<<"The product of your two numbers is "<< mult ( x, y ) <<"\n";
cin.get();
}
int mult ( int x, int y )
{
return x * y;
}
Can't understand whats the point of using the int mult ( int x, int y ) instead of
Code:
#include <iostream>
using namespace std;
int main()
{
int x;
int y;
cout<<"Please input two numbers to be multiplied: ";
cin>> x >> y;
cin.ignore();
cout<<"The product of your two numbers is "<< (x * y) <<"\n";
cin.get();
}
Need some explanation on whats the point of using int mult ( int x , int y ) and hopefully some example on where they use it on. Thanks in advance