how to sort the array of x,y co-ordinate from the richtextbox in c++/cli with respect to X and Y

denesh neupane 121 Reputation points
2021-10-29T00:23:25.357+00:00

i want to sort the richtextbox array with respect to x and y , i dont know how to do? please help

144629-capture.jpg

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
322 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,526 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Guido Franzke 2,196 Reputation points
    2021-10-29T05:56:13.447+00:00

    Hello,
    this is a simple programming task (sounds like homework).

    1. UpdateData the contents of the richeditcontrol to a string variable of the control
    2. extract all lines to an integer (x,y)-array (e.g. while-loop, ipos=find(","), v.x=atoi(left(ipos), v.y=atoi(mid(ipos+1), append v to array a)
    3. sort array as desired
    4. generate string of array (e.g. for-loop, sz+=tostring(a[i].x) + "," + tostring(a[i].y) + "\r\n" )
    5. output this string to the richeditcontrol
      When you have problems with your code, you can ask (show the code that makes problems) and we will try to help you.
      Regards, Guido