解题思路:把数字转换成字符串。
注意事项:
参考代码:
#include <iostream>
#include <string.h>
using namespace std;
void shun_order(char m[] , int n)
{
int p ;
for(p = 0 ; p < n-1 ; p++)
cout << m[p]<<" ";
cout << m[n-1] << endl ;
}
void ni_order(char a[] , int b)
{
int t,i;
for(i = 0; i < b/2; i++)
{
t = a[i] , a[i] = a[b-i-1] , a[b-i-1] = t ;
}
for(i = 0; i < b; i++)
cout << a[i];
}
int main()
{
char number[100];
int len;
cin>>number;
len = strlen(number);
cout<<len<<endl; ;
shun_order(number,len);
ni_order(number,len);
return 0;
}
0.0分
0 人评分
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:583 |
【明明的随机数】 (C++代码)(C++库中有qsort函数直接快排,不用码排序代码hhh)浏览:977 |
C二级辅导-计负均正 (C语言代码)浏览:593 |
C语言程序设计教程(第三版)课后习题12.6 (C语言代码)浏览:794 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:698 |
最长单词 (C语言代码)浏览:1376 |
计算质因子 (C++代码)浏览:1644 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:586 |
WU-格式化数据输出 (C++代码)浏览:1212 |
求圆的面积 (C语言代码)浏览:1670 |