![]() |
| ||
| convert integer to array of character??? hi every body... i have problem in my project,and i need help to solve it the problem is :: i have string variable and i want to store two values in it one value is string that insert it by the user and another value is integer that is generated by the system... the problem is in the integr value how can i append it to the string?? i think ,it must convert the integr and store it in array of characters ,then append the array to the string see my code::: that convert the integer into array of character the number consists three digits.. is it correct or not and what is the possible solutions??? thank you... #include <iostream> |
| ||
| Re: convert integer to array of character??? Use the stringstream class: #include <iostream>A string stream is like a file stream, but it works on a string instead of a file ;-> Get the string from the string stream with the str() member function (see line 17). Hope this helps. |
| ||
| Re: convert integer to array of character??? wooooooow::: thank you Duoas so much... it is great job , i really wander ,it is easy but i have questions to fully understand the code; the line 6 ::is it like declare a varible or pointer or what ?? then store the values inside it??? becouse ,when i print ss without str() i see address ,what is that mean?? what is line 12,18 mean?? is there any different when i return 0 ?? --------------- i know ,i have stupied questions but,really i surprized!!!! Thnak you for great help |
| ||
| Re: convert integer to array of character??? >the line 6 ::is it like declare a varible or pointer or what ?? It's an object definition. stringstream is a class, just like string. >becouse ,when i print ss without str() i see address ,what is that mean?? It means that stringstream doesn't have an overloaded operator<< for stringstream, so cout treats it like a pointer and prints the address. >what is line 12,18 mean?? The proper grammar is: "What do lines 12 and 18 mean?". Line 12 reads up to 10,000 characters or until a newline is found and throws them away. Line 18 returns success from main, obviously. >is there any different when i return 0 ?? No. |
| ||
| Re: convert integer to array of character??? I understand Thank you Narue for your help and sorry for weak language grammer... |
| All times are GMT -4. The time now is 1:34 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC