摘要: /*数字转换成字符串*/#include <iostream>#include <stdio.h>using namespace std;int main(){ int num = 12345; char str[20]; sprintf(str, "%d", num); cout << str;}/*数字转换成字符串*/#include <iostream>#include <stdio.h>using namespace std;int main(){ int num; char str[20] = " 阅读全文
posted @ 2013-03-08 20:26 helloweworld 阅读(181) 评论(0) 推荐(0) 编辑
摘要: /*回文数判断*/#include <iostream>#include <string>using namespace std;int main(){ string str; cin >> str; int backward = 0; int farward = str.size() - 1; for ( ; backward <= farward; backward++, farward--) { if (str[backward] != str[farward]) { break; } } if (backward > farward) { 阅读全文
posted @ 2013-03-08 19:25 helloweworld 阅读(194) 评论(0) 推荐(0) 编辑