reversing string not working

This is a discussion on reversing string not working within the C++ Programming forums, part of the General Programming Boards category; That's like saying, "They shouldn't teach you arrays, only vectors" You learn the base and learn how it was improved ...

  1. #16
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    That's like saying, "They shouldn't teach you arrays, only vectors"

    You learn the base and learn how it was improved and used in practical purposes.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  2. #17
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by indigo0086 View Post
    That's like saying, "They shouldn't teach you arrays, only vectors"

    You learn the base and learn how it was improved and used in practical purposes.
    I agree that folks should learn both new and old, but I prefer teaching new first, then comparing with the old to see how sucky things were in the past.

    It's sort of like teaching a kid to drive on an automatic instead of a stick. You really ought to learn stick, but at least get the basics of driving on roadways down first without worrying about low level stuff.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #18
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Why shouldn't they learn the C part of C++? When they encounter it in the real world it would certainly help to know that char* is also a string, but that it must be used in a more obtuse manner than a std::string.
    Teachers also have a bad habit of not telling students that what they're learning in a particular exercise is only for learning purposes and that in the real world they should do it the easy way by using the appropriate algorithms or member functions.
    You wouldn't believe how many convoluted manual linked lists I've seen people use at work when there's a much better and easier one sitting in the <list> header!

  4. #19
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Quote Originally Posted by brewbuck View Post
    I agree that folks should learn both new and old, but I prefer teaching new first, then comparing with the old to see how sucky things were in the past.

    It's sort of like teaching a kid to drive on an automatic instead of a stick. You really ought to learn stick, but at least get the basics of driving on roadways down first without worrying about low level stuff.
    I agree that the basic implementations should be used to teach the pitfalls of them and the concepts which led to the more appropriate implementations.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,632
    Why shouldn't they learn the C part of C++?
    They should, though I think that the Koenig and Moo approach of using the standard library containers to teach basic concepts is the way to go.

    When they encounter it in the real world it would certainly help to know that char* is also a string, but that it must be used in a more obtuse manner than a std::string.
    That is not true in this case: std::reverse works as well on a C-style null terminated string as on a std::string. One would just pass pointers to char (taking into account the null terminator) instead of std::string iterators.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #21
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by cpjust View Post
    Teachers also have a bad habit of not telling students that what they're learning in a particular exercise is only for learning purposes and that in the real world they should do it the easy way by using the appropriate algorithms or member functions.
    In my experience a lot of instructors have no real world experience in the first place. It is a bizarre state of affairs. There's computer science, and then there's software development. Currently the situation is that software development is being taught largely by computer scientists who have lived in academia far too long. So the students are left to their own devices and suffer "trial by fire" in the real world.

    The problem I think is that good software engineers are extremely well paid. It's just not worth their time to teach when they could actually be practicing their craft in the real world. The result is that these concepts are taught by people who, although intelligent, are not living in reality.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  7. #22
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by brewbuck View Post
    In my experience a lot of instructors have no real world experience in the first place. It is a bizarre state of affairs. There's computer science, and then there's software development. Currently the situation is that software development is being taught largely by computer scientists who have lived in academia far too long. So the students are left to their own devices and suffer "trial by fire" in the real world.

    The problem I think is that good software engineers are extremely well paid. It's just not worth their time to teach when they could actually be practicing their craft in the real world. The result is that these concepts are taught by people who, although intelligent, are not living in reality.
    Maybe the solution would be to get some of those high paid real world developers to teach a large group of teachers, who can then pass that wisdom down to their students?

  8. #23
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Quote Originally Posted by cpjust View Post
    Maybe the solution would be to get some of those high paid real world developers to teach a large group of teachers, who can then pass that wisdom down to their students?
    Or have professors work with companies ans programmers. ONe of my professors did that during the summer and speaks highly of it, he even admitted he'd done so much that you just don't do in the teaching/student world.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  9. #24
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by indigo0086 View Post
    Or have professors work with companies ans programmers. ONe of my professors did that during the summer and speaks highly of it, he even admitted he'd done so much that you just don't do in the teaching/student world.
    When I was an undergrad in CS taking the required Software Engineering courses, they were taught by a SSE from Intel. At the time, the man seemed like an alien. Nothing like any of our other instructors, and people didn't really take him seriously. Looking back now, the guy was incredibly skilled and should have been listened to more closely. But even getting the chance to talk to a worldly engineer is still a rarity.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #25
    village skeptic
    Join Date
    Aug 2008
    Posts
    31
    Relax guys, it's not for school. I'm reading Beginning ANSI C++ by Horton and trying to keep up.

    In the book, he mentions that making use of the string class is preferable over the use of a char array.

  11. #26
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by misterMatt View Post
    Relax guys, it's not for school. I'm reading Beginning ANSI C++ by Horton and trying to keep up.

    In the book, he mentions that making use of the string class is preferable over the use of a char array.
    Yes, it is. But then again, using STL algorithms are also preferable to hand written ones.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Something is wrong with this menu...
    By DarkViper in forum Windows Programming
    Replies: 2
    Last Post: 12-14-2002, 10:06 PM
  3. string array reversing...
    By cit in forum C Programming
    Replies: 4
    Last Post: 03-28-2002, 02:09 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21