0 like 0 dislike
728 views
請設計一個程式,試計算輸入字串的長度。

input:

Hello, how are you?

output:

19
[Normal] Coding (C) - asked in 2016-1 程式設計(一)AC by (-85 points)
ID: 20976 - Available when: Unlimited - Due to: Unlimited

reshown by | 728 views

7 Answers

0 like 0 dislike
Best answer
Hidden content!
* * * * * ** **
* ** *** ** * * *



int main()

{
* **** * *


** *
* ** ** **** ** ***** **** *** );
* ** 0;

}
answered by (-85 points)
selected by
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' ){
** * ** ** * ** ** *** *** * ***** **** **
**** * * * ** * * ***** * ***** * * * * *** *** * *
** * **** *** * ** ** * ** ** *** * * *** *** *** ** * * ** ** *
* ** * ** * * ******** * * * * *** * ** * ** * * * *

    }
* * ** * *** *** * * * * **
* * * ****** ***** * **** * *
* * * * ** * * * ** ** * *** len;

}
answered by (-100 points)
0 like 0 dislike
Hidden content!
* * ** * * * *
* * ***** * * *



int ***


* * * * ** * * ** i = 0,k = 0,a = 0;






*** * * **** *** != '\n'){
** **** * * * ** = **
* * * ** * **** ++;
** ******** * ** *


** * * ** * * * * ****** * *** * k-1);


**** ** * 0;

}
answered by (-122 points)
0 like 0 dislike
Hidden content!
#include ** *** ** ** *

#include * ****** * ***



int ******


* * * * ** ** a[5000];
* ** * **** * ** i = 0;


** *** * * *** * * **


*** ** * *** *** ****** ** *****


** * ** * * 0;

}
answered by (-122 points)
0 like 0 dislike
Hidden content!
** * * ***
** *** * ***
** * ** * * ***
* *** ** * *



int main()

{
* ** ** ** * * * * * * a[500];
* *** ** *** **** **** * ** *
*** * * ***** * * ** ***** * ** * ** * * * ;    
** * * * * ** 0;

}
answered by (-102 points)
0 like 0 dislike
Hidden content!
* *** ** * ** **
*** ********
*** * * ***
****** ** * * * ** * *
** ** * * * * *



int ***** ** *

{


** * * * char s[1000];


* * ** * *** gets(s);


* * *** * * ** * ** *


* * * return 0;



}
answered by (-157 points)
0 like 0 dislike
Hidden content!
* *** * * * **
* * * ** * ****** * **
* * **** * *
*** ** * * ** ** ** *
* * * ** **



int * ***** * *

{


** ** * * char s[1000];


* * * gets(s);


* * * * *** * **** * * * ** *** ** *


* *** * * * **** return 0;



}
answered by (-157 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.179
©2016-2025

Related questions

0 like 0 dislike
31 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC
ID: 20482 - Available when: Unlimited - Due to: Unlimited
| 2.5k views
0 like 0 dislike
24 answers
asked Dec 7, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points) | 1.8k views
0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC
ID: 20997 - Available when: Unlimited - Due to: Unlimited
| 549 views
0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC by 410425014 (-162 points)
ID: 20514 - Available when: Unlimited - Due to: Unlimited
| 546 views
0 like 0 dislike
5 answers
[Normal] Coding (C) - asked Dec 27, 2016 in 2016-1 程式設計(一)AC by 410342026 (-105 points)
ID: 20135 - Available when: Unlimited - Due to: Unlimited
| 883 views
12,783 questions
183,442 answers
172,219 comments
4,824 users