Ok, I totally redid it. Here is what I have
Code:
#include<iostream.h>
#include<math.h>
main()
{
int i;
float a[5],sum=0;
cout<<"\n Enter 5 numbers:\n\t\t\t";
for(i=0;i<5;i++)
{
if(i==4)
{
cout<<"\n You are entering the last number:\n\t\t\t";
}
cin>>a[i]; cout<<"\n\t\t\t";
sum+=a[i];
}
{
cout<<"\n The number of data: 5\t\t";
cout<<"\n The sum is:\t\t"<<sum;
cout<<"\n The average is:\t"<<(sum/5) ;
}}
I'm having the following troubles: I can't get the cout to print the entered data, and also, I wish to extend this program to enable any number of data to be entered, not just "5". This means I would have to signal the program to let it know when the last datum has been entered. Can you help me with this?