Converting exponents to regular numbers

I have a code that outputs the first two numbers in exponent form (1.2e+07 for example). I would need it to output 12000000 instead. Can someone tell me how this is possible?
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
int main ()
{   
  int years[11];
  float salary [11];
  float annual [11];
  float sixteen [11];
  float eightteen [11];
  float average=0;
  float highannual=0;
  int highvalby=0;
  float high16games=0;
  float low16games=0;
  float range16=0;
  float high18games=0;
  float low18games=0;
  float midrange=0;
  float avgdiff1618=0;
  
  for (int x=1; x<=10; x++)
      {
        cout<<"For "<<x<<", years are: ";
        cin>>years[x];
        cout<<"For "<<x<<", salary is: ";
        cin>>salary[x];
        annual[x]=salary[x]/years[x];
        sixteen[x]=annual[x]/16;
        eightteen[x]=annual[x]/18;
      }
  
  
  //Number 1
  for (int j=1; j<=10; j++)
      {
      average=average+annual[j];
      }
  average=average/10.;
  
  
  //Number 2
  highannual=annual[1];
  for (int k=2; k<=10; k++)
    {
     if (highannual<annual[k])
         {
            highannual=annual[k];
            highvalby=k;
         }
    }
 
 
  //Number 3
  high16games=sixteen[1];
  for (int i=2; i<=10; i++)
    {
      if (high16games<sixteen[i])
          {
            high16games=sixteen[i];
          }
    }
  low16games=sixteen[1];
  for (int l=2; l<=10; l++)
      {
        if(low16games>sixteen[l])
            {
              low16games=sixteen[l];
            }
      }
  
  range16=high16games-low16games;
  
  
  //Number 4
  high18games=eightteen[1];
  for (int m=2; m<=10; m++)
    {
      if (high18games<eightteen[m])
          {
            high18games=eightteen[m];
          }
    }
  low18games=eightteen[1];
  for (int n=2; n<=10; n++)
      {
        if(low18games>eightteen[n])
            {
              low18games=eightteen[n];
            }
      }
  midrange=(high18games+low18games)/2;
  
  
  //Number 5
  for (int o=1; o<=10; o++)
    {
      avgdiff1618=(avgdiff1618+(sixteen[o]-eightteen[o]));
    }
  avgdiff1618=avgdiff1618/10;
  
  
  average=average*1000000;
  highannual=highannual*1000000;
  range16=range16*1000000;
  midrange=midrange*1000000;
  avgdiff1618=avgdiff1618*1000000;
  clrscr ();
  cout<<"1. "<<average<<endl;
  cout<<"2. "<<highannual<<" by #"<<highvalby<<endl;
  cout<<"3. "<<range16<<endl;
  cout<<"4. "<<midrange<<endl;
  cout<<"5. "<<avgdiff1618<<endl;
  
  cout<<"\n\n\n\n\n";
  return 1; 
}
this is not working for me. It outputs too many zeros.
Can you try for the inputs:
5, 57.5
6, 56.5
6, 72
6, 60
5, 51
5, 50
5, 49
5, 33.4
5, 23
5, 18.9

1 should be 8797667
2 should 12000000 by #3
3 should be 513750
4 should be 438333
5 should be 61095
That's what it shows, just with a . and some decimals. I don't think you can get what you want this way. Look into printf, boost lexical cast (I don't know if they would really provide what you want) or hack it yourself with a stringstream or simply cast to int (which won't work if you have more than 10 digits).
Topic archived. No new replies allowed.