what am i doing wrong

closed account (ShUk4iN6)
I saw a topic on here it was like this but my problem is kind of different
when I run the program my average is always the number i typed in but i want it to take the average when i type other numbers too so my first number is 86 second is 84 the average needs to be 85
but in my program its always thee number i type..help pls

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
using namespace std;

int main()
{
	float ftemp=0.0;
	float ctemp= 0.0;
	float select = 0;
	float average = 0;
	float total = 0;
	float count = 0;
	
 
  
  cout.precision(4);
  cout << "      ftemp     ctemp";
  
  while (ftemp!= -99999)

  {
	cin>>ftemp;
	ctemp = (ftemp-32) * 5. / 9.;
	average = (ftemp + ftemp) / 2;
    cout.width(8);
	cout << ftemp << " ";
    cout.width(8);
    cout << ctemp << '\n';
	count++;
	
	average= average+(total/count);
	cout<< "average "<<average <<endl;

  }

  return 0;
}

Last edited on
cout<< "average "<<average <<endl;


remove from the while loop.
Topic archived. No new replies allowed.