2.求一个整数有几位(简单字符串操作)


 

 时间限制: 1 s
 空间限制: 1000 KB
题目描述 Description

求一个整数有几

第一行输入一个整数(int)N(如2563)

第二行输出该整数N是个几位数(4).

 

 

输入描述 Input Description

第一行是个整数,例如2563

输出描述 Output Description

第二行,如4

样例输入 Sample Input

34532

样例输出 Sample Output

5

数据范围及提示 Data Size & Hint

求一个整数有几

第一行输入一个整数(int)N(如2563)

第二行输出该整数N是个几位数(4).

源代码如下:

#include

using namespace std;

#include

#include

int main()

{

char s[101];

gets(s);

cout<<strlen(s)<<endl;

return 0;

}

posted on 2016-02-22 15:46  142141241  阅读(133)  评论(0编辑  收藏  举报

导航