Fix Lesson 2 Task 4
This commit is contained in:
parent
cae32898fb
commit
3fcab8541d
1 changed files with 3 additions and 3 deletions
|
@ -10,10 +10,10 @@ int main()
|
||||||
int words = 1;
|
int words = 1;
|
||||||
|
|
||||||
for (int character = 0; character < 256; ++character) {
|
for (int character = 0; character < 256; ++character) {
|
||||||
if (str[character] == ' ')
|
if (str[character] == 0)
|
||||||
++words;
|
|
||||||
else if (str[character] == 0)
|
|
||||||
break;
|
break;
|
||||||
|
else if (str[character] < 'A' || str[character] > 'z')
|
||||||
|
++words;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Number of words: " << words << endl;
|
cout << "Number of words: " << words << endl;
|
||||||
|
|
Reference in a new issue