Help with getting longest string

This is a discussion on Help with getting longest string within the C++ Programming forums, part of the General Programming Boards category; Please post your code in [code][/code] tags, tell us exactly what is not working, what input you give it, and ...

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    Please post your code in [code][/code] tags, tell us exactly what is not working, what input you give it, and the output you get or the exact compiler errors you get.

    BTW, I edited my post above and gave one reason why your while loop might not work. See if that is the issue.
    Last edited by Daved; 09-21-2006 at 03:41 PM.

  2. #17
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    You'll need to include <string> and have using namespace std or using std::string either directly or indirectly (in a header file). If it compiles then you've already done this.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #18
    Registered User
    Join Date
    Sep 2006
    Posts
    10
    Code:
    main
                 {
                    //code
    Isn't an int needed in front of main?

  4. #19
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    It is supposed to be there according to the standard, but some compilers will allow code without it. Regardless, there isn't really a good reason not to put it in.

  5. #20
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #21
    Registered User
    Join Date
    Sep 2006
    Posts
    10
    ahh...

    Another thing learned. I really should read the FAQ.

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

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 03:13 PM
  3. Something is wrong with this menu...
    By DarkViper in forum Windows Programming
    Replies: 2
    Last Post: 12-14-2002, 10:06 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 02:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

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