#include <iostream>
#include <cstring>
usingnamespace std;
int main(){
double Tm=0; //minimum Temp
double TM=50000; //Max Temp
double T0,T1,Ts; //given minimum, max and step Temps
cout<<"Please give in a lower limit >="<<Tm<<"°C:";
cin>>T0; //minimum Temp
cout<<"'\n'Please give in a higher limit <="<<TM<<"°C:";
cin>>T1; //Max Temp
cout<<"'\n'Please give in a step, 0 < step < "<<T1-T0<<":";
cin>>Ts; //step
int nbrlines;
double nbrline;
nbrline = 1+(T1-T0)/Ts;
nbrlines=(int)nbrline; //number of lines in the array to use later
double array[2][nbrlines];
for(int x=0;x<nbrlines;x++){
array[x][0]=T0+x*Ts;
array[x][1]=32+9*(array[x][0])/5;} //build the array
//printing:
cout<<"Conversion table:\n";
cout<<"Celsius"<<'\t'<<"Fahrenheit\n";
cout<<"-------"<<'\t'<<"----------\n";
for(int x=0;x<nbrlines;x++){
cout<<array[x][0]<<'\t'<<array[x][1]<<'\n';
}
cin.get();
}
The problem is that,for temperatures between 10 and 20°C separted by 1°C for instance, the result is correct until T=15°C, the next line is "nan 5.56112e+260" (all the following are false too.