やってみてください
役に立った:0件
文字列を入力させ、入力した文字列の長さを出力させるプログラムを作成せよ。
if switch for while do-while 配列 をなるべく使う。
<実行結果>
文字列を入力してください
society
Length of "society" is 7
ご参考に。
#include <stdio.h>
#include <string.h>
#define BUF_SIZE 1024
int main(void)
{
char str[1024];
printf("input a str.\n");
scanf("%s", str);
printf("Length of \"%s\" is %d\n", str, strlen(str));
return 0;
}
質問者のみ:ベストアンサーを選ばずに質問を締切る
- 最新から表示
- |
- 回答順に表示













