Computing.Net > Forums > Programming > String to Integer??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

String to Integer??

Reply to Message Icon

Name: MidnightBlue
Date: October 27, 2004 at 08:41:20 Pacific
OS: Windowx XP
CPU/Ram: Pentium IV
Comment:

Hi Everyone!
I'm taking a C/C++ course this semester and I'm finding it really hard since I've never taken a programming class before. I'm working on a program right now, and for one part of it I have to convert a string value that is entered by the user to either an integer or a float, using the atoi and atof function. I know I have to declare the #include <stdlib.h> header file, but after that I'm pretty much lost :( My professor isn't much help seeing as how he's never in his office, so any help you all could give me would be greatly appreciated! Thank you so much! =)



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: October 27, 2004 at 11:24:31 Pacific
Reply:


Doesn't your compiler have any documentation?? atoi() and atof() are pretty easy to use.


int i;
char string[10] = "123";

i = atoi(string);


Reading the book would probably help too!


0

Response Number 2
Name: MidnightBlue
Date: October 27, 2004 at 23:07:29 Pacific
Reply:

Thank you Don! =)

Yeah I'd love to read the book but my dear professor said that we didn't need one because his teaching would be good enough. So he didn't order one for the class. Sweet huh :P Thank you so much!! =)


0

Response Number 3
Name: Chi Happens
Date: October 28, 2004 at 06:16:59 Pacific
Reply:

Midnight Blue,
If you want to learn C++, then pick up Dietel's How To Program C++. It is great. It teaches C++ as well as some legacy C.

http://www.amazon.com/exec/obidos/tg/detail/-/0130384747/qid=1098969368/sr=8-1/ref=pd_csp_1/002-6999756-6899242?v=glance&s=books&n=507846

It (like all programming books) is expensive...but maybe you can ask for it for your bday or xmas (if you celebrate xmas)

Hope this helps,
Chi

"They mostly come at night...mostly"


0

Response Number 4
Name: MidnightBlue
Date: October 28, 2004 at 12:15:22 Pacific
Reply:

Thanks Chi! And my birthday is coming up next week as a matter of fact! I'll make sure I'll let someone know abou that book :P


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: String to Integer??

String to Integer in Visual Basic www.computing.net/answers/programming/string-to-integer-in-visual-basic/5960.html

string to integer www.computing.net/answers/programming/string-to-integer/3830.html

SQL string to integer conversion www.computing.net/answers/programming/sql-string-to-integer-conversion/11425.html