No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
5 Posted Topics
notice this in your code [code=C++] // inFile is a file input stream, and it havn't open a file yet, so you got the error inFile >> fileName; [/code] I guess you wanna this: [code=C++] // read user input fileName from command line cin >> fileName; [/code]
hey Ellisande, you said you've spent a lot of time on this, so I think I can give you a sample program. Please notice that it's not a perfect solution, you need to refine it, considering many error conditions, etc. Also, if you have any questions about the function I …
hi all guys I don't know if the thread have been marked solved or not (by the way, any guy can tell me how to judge that?), and maybe ellimist have fixed his problem already, I don't know, I just have a better solution [code=C++] #include <string> #include <algorithm> #include …
walom, your give the atoi function a overflow parameter. the max integer is 2147483647, which is less than "23423423423", so the result of atoi is incorrect. I give you two advices: [INDENT]1. use [B]atol[/B] instead of atoi, which turns a string to a long integer[/INDENT] [INDENT]2. refer to the [B]number_limits[/B] …
Try this : [code=C++] #include <algorithm> #include <string> #include <iostream> using namespace std; int main() { string str = "abcdefg"; cout << str << endl; reverse(str.begin(), str.end()); cout << str << endl; return 0; } [/code] I think it's the simplest way to do your job.
The End.
Zhujy