M
Marcelo De Brito
Hi!
I have implemented a simple program to convert temperatures from
Celsius to Fahrenheit and vice-versa, printing them on a simple table.
The max temperature (that is, the maximum value until which the table
must be printed) is passed through command line to the program:
../temp_convert 100
This command tells the program to print a table of temperatures until
the max value 100 is reached.
When passing negative values, such as:
../temp_convert -100
The program does not work at all.
For getting the value through command line, I used the "atoi()"
function in this way:
max_temp = atoi(argv[1]);
Does this problem have something to do with the "atoi()" function?
I appreciate your comments and suggestions.
Best Regards!
Marcelo
I have implemented a simple program to convert temperatures from
Celsius to Fahrenheit and vice-versa, printing them on a simple table.
The max temperature (that is, the maximum value until which the table
must be printed) is passed through command line to the program:
../temp_convert 100
This command tells the program to print a table of temperatures until
the max value 100 is reached.
When passing negative values, such as:
../temp_convert -100
The program does not work at all.
For getting the value through command line, I used the "atoi()"
function in this way:
max_temp = atoi(argv[1]);
Does this problem have something to do with the "atoi()" function?
I appreciate your comments and suggestions.
Best Regards!
Marcelo