// last 18lb.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
#include <string.h>
#include <conio.h>
#include <clocale>
using namespace std;
int main()
{
setlocale(0,".1251");
char s[100];
puts(" Ввести строку:");
gets_s(s, 100);
unsigned int a = 0, i;
for (i = 0; i < strlen(s); i++)
{
if ( (s[i - 1] == ' ') && (isalpha((unsigned char)s[i])) && ((unsigned char)s[i] < 128))
++a;
}
cout << "В строке: " << a << " слов";
getch();
}
================================================================================
|