dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: 2kaud

Search: Search took 0.02 seconds.

  1. Thread: Code repetition

    by 2kaud
    Replies
    13
    Views
    793

    Re: Code repetition

    yep! :thumb:

    PS Take a bonus point for using equal() to test for a palindrome. :cool:
  2. Thread: Code repetition

    by 2kaud
    Replies
    13
    Views
    793

    Re: Code repetition

    For your code, having const/not const there will make no run-time difference. It's just good practice you should get into the habit of using where appropriate.

    Hint. Try moving the cin.ignore()...
  3. Thread: Code repetition

    by 2kaud
    Replies
    13
    Views
    793

    Re: Code repetition

    bool is_palindrome(const string &s)


    You are passing s by reference, so any changes to s in the function are passed back to the corresponding argument variable in the calling function. If the...
  4. Thread: Code repetition

    by 2kaud
    Replies
    13
    Views
    793

    Re: Code repetition

    If you put it there, it may seem to work - but try entering aaa as the input to the 'another computation' prompt.
  5. Thread: Code repetition

    by 2kaud
    Replies
    13
    Views
    793

    Re: Code repetition

    Yes.

    Also


    bool is_palindrome( string &s)


    would be better defined as
  6. Thread: Code repetition

    by 2kaud
    Replies
    13
    Views
    793

    Re: Code repetition

    Firstly,


    is_palindrome ( input );

    if ( is_palindrome )



    Don't you mean
Results 1 to 6 of 6


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.