Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ 2 QM
#1
What is the equivalent QM code for the following C++ code Smile
 
#1   (For statement section)
 
Code:
Copy      Help
int pos = SendEditor(SCI_GETCURRENTPOS);
int nPrevLinePos = SendEditor(SCI_POSITIONFROMLINE,line-1);
int c = ' ';
for(int p = pos-2;
    p>=nPrevLinePos && isspace(c);
    p--, c=SendEditor(SCI_GETCHARAT,p));

#2  (Char type variable definition section)
Code:
Copy      Help
char space[1024];
memset(space,' ',1024);
space[nIndent] = 0;
SendEditor(SCI_REPLACESEL, 0, (sptr_t)space);
#2
About For statement 
I still haven't converted successfully. I found some sample code below
 
Code:
Copy      Help
;QM
for i 0 5
,code

;C++, C#
for(i=0; i<5; i++)
{
,code
}
________________________________
;QM
rep 5
,code

;C++, C#
for(int i=0; i<5; i++)
{
,code
}
#3
Result of using ChatGPT conversion:  It's all wrong Wink

#1
Code:
Copy      Help
int pos = SendEditor(SCI_GETCURRENTPOS);
int nPrevLinePos = SendEditor(SCI_POSITIONFROMLINE, line-1);
int c = ' ';
for (int p = pos - 2; p >= nPrevLinePos && isspace(c); p--) {
    c = SendEditor(SCI_GETCHARAT, p);
}

#2
Code:
Copy      Help
str space="";
for (int i=0; i<nIndent; i++) {
    space+=" ";
}
SendMessage(sci, SCI_REPLACESEL, 0, &space);


Forum Jump:


Users browsing this thread: 1 Guest(s)