I want to show the output like below:
Count Input Total
----- ------ -----
1 2 2
2 4 6
3 6 12
4 8 20
Average : 5
Here is my try:
int count=1,num,total=0;
cout<<"Count Input Total"<<endl;
cout<<"----- ----- -----"<<"\n";
while(count<=4)
{
cout<<count<<"\t";
cin>>num;
total=total+num;
cout<<"\t\t"
<<total<<endl;
count++;
}
cout<<"Average : "
<<total/4;
return 0;
}
but it comes out like this:
Count Input Total
----- ----- -----
1 2
2
2 4
6
3 6
12
4 8
20
Average : 5
--------------------------------
Process exited after 5.785 seconds with return value 0
Press any key to continue . . .