CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2011
    Posts
    9

    How to Check if Data is Sorter in C++

    Dear Experts,
    I would like to know how to check if the string data is sorted in c++ in ascending order
    For example i want to check if below data is sorted if not i wish to prompt error

    "<subName>ABC-R4</subName>"
    "<subName>ABC-R1</subName>"
    "<subName>ABC-R3</subName>"
    "<subName>ABC-R2</subName>"

    Thanks!
    Last edited by geforce23; July 12th, 2011 at 10:58 PM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: How to Check if Data is Sorter in C++

    Can't you use any Comparison operations with these texts?
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2011
    Posts
    9

    Re: How to Check if Data is Sorter in C++

    This is example set of Text.....
    The value can be many.
    It wont be a fix/hardcoded.It will be received from another application

    Thanks!

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: How to Check if Data is Sorter in C++

    Quote Originally Posted by geforce23 View Post
    This is example set of Text.....
    The value can be many.
    Then do the comparisons in the loop...
    Victor Nijegorodov

  5. #5
    Join Date
    Jun 2011
    Posts
    9

    Re: How to Check if Data is Sorter in C++

    Im new to C++ programing
    is it the looping will be something like this

    for (int i = 0; i <= u_nb - 1; i++) {

    Thanks!

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: How to Check if Data is Sorter in C++

    Victor Nijegorodov

  7. #7
    Join Date
    Jun 2011
    Posts
    9

    Re: How to Check if Data is Sorter in C++

    Thanks Sir.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured