哦,以上是指在c#中,另外能在给出 其它几个类型的转换更好 float,double

解决方案 »

  1.   

    int->string:
    char buf[16];
    int i = 12345;
    itoa(i , buf , 10);
    string s = buf;int->char:
    int i = 5;
    char c = i + '0';
    //Or char c = i | 0x30;
    //The value of i should be in [0 , 9].string->int:
    string s = "12345";
    int i = atoi(s.c_str());string->char:
    ??char c = s[0];??char->int:
    char c = '5';
    int i = c - '0';
    //Or int i = c &0x0f;char->string:
    char c = 'A';
    string s = c;
      

  2.   

    Oh, My dog.
    没看清,给出了C++中的,算了,当我没说。
      

  3.   

    在c#中用Convert进行转换
    如int->string
    Convert.ToString(int)
      

  4.   

    谢谢楼上问题解决,,,使用convert就可以搞定