John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
I am not showing-off, But just want to tell that how can STL come to your rescue.
The program submitted by Haji Akhundov, Can be shorten to few lines only.
#include<iostream>
#include<string>
#include<algorithm>
int main()
{
std::string orig, rev;
std::cin>>orig;
rev=orig;
std::reverse(rev.begin(), rev.end() );
if (rev==orig)
std::cout<<"Yes";
else
std::cout<<"No";
}
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
And I'd like to point out that hajiakundov and siddhant3s have both not helped confused! to learn. Giving answers only gets the assignment done, but does not promote learning how to do the assignment.
Please read the stickies at the top of this forum.
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
>And I'd like to point out that hajiakundov and siddhant3s have both not helped >confused! to learn. Giving answers only gets the assignment done, but does >not promote learning how to do the assignment.
I agree. Neither do I like it. Read My post about it.
http://www.daniweb.com/forums/post813528.html#post813528
These are few quotes from in there:
Please note:
I know no one gets paid to help here. I even know that you can debug the flawed code very quickly and repost it. But the real pain lies in explaining the things to the new-bie so that he can get meaning to your code.
I was just trying to point to Haji Akhundov's post, that the things could be done in much simple manner with STL in hand. I was trying to show, the number of lines which gets reduced while using STL
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
Please don't reply to old posts, it does tend to confuse the situation. If you have a question regarding an old post, start a new thread, and feel free to refer to the old one.
That way near-sighted old farts like me don't get all riled up. ;)
After all, you did write as if responding to the OP, who, as you said, has probably long completed the assignment.
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228