str111,str:String;
i,j:integer;
str111:=str111+char(integer(str[i])-j);
可以帮我把这句话翻译成VC代码吗? 我翻译是这样的,错在哪里?
int j=4;
CString str111 = _T("");for(int i=1;i<=s.GetLength();i++)
{
str111 = str111 + (char)(_wtoi(s.GetAt(i))-j);
}

解决方案 »

  1.   

    CString str;
    CString str111;
    int i;
    int j;str111 += (int)str[i] - j;
      

  2.   

    Delphi循环是这样:
      str111 := '';
      for i:=1 to length(str) do    
      begin
        str111:=str111+char(integer(str[i])-j);
      end;
      

  3.   

    int j=4;
    CString str111 = _T("");str111 = str111 + (char)(_ttoi(s.GetAt(i))-j);既然前面用的是 _T 宏而不是直接 L"" 定义宽字符串
    那么后面使用的函数应该也是类似的 ttoi 而不是直接使用 wtoi
      

  4.   

    int j=4;
    CString str111 = _T("");
    for(int i=1;i<=s.GetLength();i++)
    {
    str111 = str111 + (char)(_ttoi(s.GetAt(i))-j);
    }
      

  5.   

    cannot convert parameter 1 from 'unsigned short' to 'const unsigned short *'
    楼上的编译都通不过....
    因为是UINICODE编码
      

  6.   

    CString str;
    CString str111 = _T("");
    int j;for (int i = 0; i < str.GetLength(); i++)
    {
        str111 += (TCHAR)(_ttoi(s.GetAt(i))-j);
    }
      

  7.   

    int j=5;
    CString str111 = _T("");
    for(int i=0;i<s.GetLength();i++)
    {
    str111 = str111 + (TCHAR)(int(s[i])-j);
    //str111 += (TCHAR)(_ttoi(s.GetAt(i))-j);
    }问题已经解决,谢谢各位....