Toggle navigation
Courses
Questions
Tags
Users
AC 字串練習題 判斷字串長度
0
like
0
dislike
249
views
請設計一個程式,試計算輸入字串的長度。
input:
Hello, how are you?
output:
19
[Normal]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
林佳慧
(
-85
points)
ID: 20976 -
Available when:
Unlimited
-
Due to:
Unlimited
reshown
Jan 5, 2017
by
Shun-Po
|
249
views
comment
Please
log in
or
register
to add a comment.
7
Answers
0
like
0
dislike
Best answer
Hidden content!* * ** * * * * *
* * * * * * * ** *
int main()
{
* * * * * * * **
* *** * *
** ** * ***** * ** * * * * * * * );
* * * ** 0;
}
answered
Jan 5, 2017
by
林佳慧
(
-85
points)
selected
Jan 5, 2017
by
林佳慧
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!#include <stdio.h>
#define MAXLEN 10000
int getStr(char line[], int nmax);
int main(void){
* * * *** * * * ** ** * strLen;
* * * * ** * * ** * * buffer[MAXLEN+1];
** * ** ** * * ** * * * * * *
* **** * ** * ** * ** ** * * * ** * ** * * = getStr(buffer, MAXLEN);
* * * *** * * * * ** ** ** * * * ** **** * ** * (strLen==0)
* * ** * ** * * * * * * ** * * ** * ** * * * * * ** ** ** * * ********** *** ** * *
** * * *** ** ** * ** *** * * * * * ** * ** * ** ** * ** * * * ** * *
** * ** ** * ** ** * **
}
int getStr(char *buffer, int maxLen){
* * * * ** ** * ** * c;
* * * * *** * * **** *** * * len = 0;
* ** ** *** * * ** * * * (c=getchar()) != '\n' ){
* * * ** *** * * * * * * * * * *** * * *** *** ** **** **** *
* ** * * ** ** ** * ****** ** * * * * * ** **** **** * *** * *
* * ** ** * ** * ** ** * * * * * * * * * ** * ** * * * ** *
* ** *** * * * * ** * * * * *** ** * * ***
}