But after writing out the codes , i encounter a tiny problem and i hope some pro can help to enlighten me out

Basically , i wanna get rid of the last " , "
Quote:
|
#include <iostream> using namespace std; void entry(double temp[]); void display(double temp[]); double avg_Temp(double temp[]); int main() { double temp[5]; double average; cout << "Room Temperature Analysis" << endl; cout << "=========================" << endl<<endl; entry(temp); // Call function to allow user to enter the readings display(temp); average = avg_Temp(temp); cout << endl << endl << "Average temperature is : " << average ; return 0; } // Your functions here void entry(double temp[]) { int i ; for (i=0;i<5;i++) { cout << "Enter temperature : " ; cin >> temp[i]; } return; } void display(double temp[]) { int i ; cout << endl; cout << "You have entered the following readings: " ; for (i=0;i<5;i++) { cout << temp[i] << " , " ; } return; } double avg_Temp(double temp[]) { int i ; double sum = 0 , ave ; for (i=0;i<5;i++) { sum = sum + temp[i] ; } ave = sum / 5.0 ; return ave ; } |






Linear Mode
21 OCZ Fans!