Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void average(float, float, float *);
- int main()
- {
- float input1, input2, outcome;
- cout << "Enter two numbers: ";
- cin >> input1 >> input2;
- average(input1, input2, &outcome);
- cout << "The average is : " << outcome;
- return 0;
- }
- void average(float num1 , float num2 , float *result)
- {
- // The star dereferences result ( The '*' is the dereferencing symbol)
- *result = (num1 + num2) / 2.0;
- }
Add Comment
Please, Sign In to add comment