我不会了帮帮我帮我看看

任务描述:从键盘读入一个整数,统计该数的位数。输入345678,输入6;输入10;输入2;输入-30,输入2,输入1,输出1。

1、用itoa函数转成字符串。
2、求字符串长度即可。
3、整数为正数,长度就是输出。整数为负数的值,长度-1就是输出的值。

这么简单的题,现在的学生怎么都不自己做啊...真的是为你好啊.反观我自己的过去,也没什么资格说别人就是了.

Satisfied?

#include "stdio.h"
#include "string.h"

int main()
{
    //you must declare the fucking variable to hold the input content, and I will set it to an 100 bytes char array.
    //If  you think you can input a larger number, feel free to change the size(who the hell wants to use such a large number?).
    char input[100];

    //just some fucking friendly hint message.
    printf("Please input the fucking integer you want(the programme will treat it as a string anyway), then hit the fucking Enter:\n");
    
    //read the fucking input content from your keyboard, and store it in input as a string.
    scanf("%s", input);

    //print the result by using strlen function.
    printf("the fuck length of the fucking number is: %ld\n", strlen(input));
}

负数的判断研究一下吧.

算了

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
    char input[100];
    int i;

    printf("Please input the fucking integer you want(the programme will treat it as a string anyway), then hit the fucking Enter:\n");
    
    scanf("%d", &i);

    if (i<0) {
        i = 0-i;
    }
    sprintf(input, "%d", i);
    printf("the fuck length of the fucking number is: %ld\n", strlen(input));
}