正整数转string型

//正整形转换为string型 string FNumChangeCString(int i) { //序号 string SerialNumber; SerialNumber.resize(0); if (i < 0) { return SerialNumber; } if (i == 0) { SerialNumber.push_back('0'); return SerialNumber; } //余数 int Remainder = 0; while (i != 0) { Remainder = i % 10; SerialNumber.push_back(Remainder + '0'); i = i / 10; } size_t Size = SerialNumber.size(); size_t size = Size / 2; char temp; for (size_t i = 0; i < size; i++) { temp = SerialNumber[i]; SerialNumber[i] = SerialNumber[Size - i - 1]; SerialNumber[Size - i - 1] = temp; } return SerialNumber; }

【正整数转string型】

    推荐阅读