Home > Back-end >  Of new thought for a minute!
Of new thought for a minute!

Time:12-10


the first picture of the code is compiled, me and others are not quite same, want to teach any mistakes or insufficient,
topic is this: your program to read a line of text, which is suitable for several words separated by Spaces, with the '. 'end, do you want to output the length of each word in the line of text, the word has nothing to do with language, can include various symbols, such as "it' s" count as one word, the length is 4, note that may emerge in the line of continuous Spaces,

CodePudding user response:

Input is the first program ". "after the end of cycle, then output the length of the S1 (not including". "), otherwise the output length of S1 + null character, and then continue to cycle,
You this is to check whether the first a character in a as "" or". ", if the output is a - B, then B=a + 1,
First of all, you are the only one keyboard input, can't be cycle, if enter a null character for the first time, your a. ength () may be zero;
Moreover, the first is the ". "if you don't input, input infinitely print result; The only input "" or". "you didn't print the results
Finally, the first printed as input characters, you print is zero,

CodePudding user response:

reference at any time in the 1/f, efforts will be made no later reply:
is the first program input ", "after the end of cycle, then output the length of the S1 (not including". "), otherwise the output length of S1 + null character, and then continue to cycle,
You this is to check whether the first a character in a as "" or". ", if the output is a - B, then B=a + 1,
First of all, you are the only one keyboard input, can't be cycle, if enter a null character for the first time, your a. ength () may be zero;
Moreover, the first is the ". "if you don't input, input infinitely print result; The only input "" or". "you didn't print the results
Finally, the first printed as input characters, you print is 0,

Print characters in length, a typo

CodePudding user response:

Did you see the anti?? , the first picture is me, but thank you also take a look at my post,

CodePudding user response:

The second picture is I read on the Internet a lot of people thumb up the forehead

CodePudding user response:

reference 4 floor BanZhuannn response:
the second picture is I read on the Internet a lot of people thumb up amount


Your program algorithm is wrong, so the topic request 1 row string is input, your program input multi-line string, topic request calculating the length of each word in the string, not including the Spaces between words, your program just calculate multi-line string length, and length which contains Spaces, see clear title,
  • Related