hi every1 i also need help with my assignment
im supposed to find the errors and explain how to correct it
heres the program:
//question 3a
#include <iostream>
using namespace std;
int main ( )
{
int nrLuggagepieces;
float mass, total mass;
int averageMass;
// initialize
totalMass = 0;
// loop
while (mass > 0)
{
//input next mass
cout << "Please enter mass of next piece of luggage (0 to end): ";
cin >> mass;
//update totals
totalMass += mass;
nrLuggagePieces++;
} //end of whileloop
// display number of pieces of luggage
cout << "The number of pieces is " << nrLuggagePieces << endl;
//average (0.5 is added in order to round off)
if (nrLuggagePieces > 0)
averageMass = int (totalMass / nrLuggagePieces + 0.5);
else
averageMass = 0;
cout << "The average mass of a piece of baggage is"
<< averageMass <<endl;
return 0;
}