Jump to content

post-33018-0-38322100-1378680758_thumb.p

 

It's supposed to convert the temperature from the input in Celsius (which the professor used an int for an example) and he wanted us to use fgets() to get the input and atof() to convert the string from fgets into a float (2 spaces after decimal). I just want to know how to get this to run then I will fix the floating point. Thanks for those that can help :P

i5 4670k | Sapphire 7950 | Kingston 120GB SSD | Seagate 1TB | G.Skill Ripjaw X Series 8GB

PB238Q | Steelseries Sensei | Ducky DK9087 | Qck Heavy

Build Log: http://linustechtips.com/main/topic/44902-from-imac-to-my-own-creation/

Link to comment
https://linustechtips.com/topic/54572-programming-in-c-help/
Share on other sites

Link to post
Share on other sites

1st: The warning about atof being implicit declared is solved by #including stdlib.h

 

2nd: #defines work by replacing the first "argument" by whatever comes after it in every place it is found on the code. This means that the way you are doing it, MAX_INPUT is being replaced by "= 10" everywhere, which is the source of all the errors.

Link to comment
https://linustechtips.com/topic/54572-programming-in-c-help/#findComment-733452
Share on other sites

Link to post
Share on other sites

1st: The warning about atof being implicit declared is solved by #including stdlib.h

 

2nd: #defines work by replacing the first "argument" by whatever comes after it in every place it is found on the code. This means that the way you are doing it, MAX_INPUT is being replaced by "= 10" everywhere, which is the source of all the errors.

Oh my jesus thank you. let me edit it and see how it works now lol

i5 4670k | Sapphire 7950 | Kingston 120GB SSD | Seagate 1TB | G.Skill Ripjaw X Series 8GB

PB238Q | Steelseries Sensei | Ducky DK9087 | Qck Heavy

Build Log: http://linustechtips.com/main/topic/44902-from-imac-to-my-own-creation/

Link to comment
https://linustechtips.com/topic/54572-programming-in-c-help/#findComment-733474
Share on other sites

Link to post
Share on other sites

1st: The warning about atof being implicit declared is solved by #including stdlib.h

 

2nd: #defines work by replacing the first "argument" by whatever comes after it in every place it is found on the code. This means that the way you are doing it, MAX_INPUT is being replaced by "= 10" everywhere, which is the source of all the errors.

It's working now. thank you!!! God I've been staring at that for too long and it's always the simple things messing you up. I did have the stdlib.h included at one point but I deleted it O.o

i5 4670k | Sapphire 7950 | Kingston 120GB SSD | Seagate 1TB | G.Skill Ripjaw X Series 8GB

PB238Q | Steelseries Sensei | Ducky DK9087 | Qck Heavy

Build Log: http://linustechtips.com/main/topic/44902-from-imac-to-my-own-creation/

Link to comment
https://linustechtips.com/topic/54572-programming-in-c-help/#findComment-733489
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×