I am trying to learn how to program in C++. I have an assignment that requires me to take three numbers and find the product, the sum, and the average. Here is what I have so far, after I enter in my three numbers the window closes and does not give me the product. Please help.
#include <iostream> // input/output declarations
#include <iomanip> // i/o manupulator declarations
using namespace std;
// function prototypes
float product( float firstnumber, float secondnumber, float lastnumber );
int main()
{
float firstnumber; // First number
float secondnumber; // Second number
float lastnumber; // Third number
float product; // The product of all 3 numbers
// Set up floating point output format
cout << fixed << showpoint << setprecision(2);
// Entering three numbers for computation
cout << "Enter first number: ";
cin >> firstnumber;
cout << "Enter second number: ";
cin >> secondnumber;
cout << "Enter last number: ";
cin >> lastnumber;
// Product of 3 numbers
product = firstnumber, secondnumber, lastnumber ;
// Print
cout << " If these numbers are used:" << endl;
cout << " " << firstnumber << " first number" << endl;
cout << " " << secondnumber << " second number" << endl;
cout << " " << lastnumber << " third number" << endl;
cout << " the product will be " << product << endl;
return 0;
}