View Code of Problem 58

#include<stdio.h>
#include<math.h>
#include<ctype.h>
#include<string.h>
#include<iostream>
using namespace std;
#include<algorithm>
int main()
{
	char str[100];
	char a[100];
	int flag = 0;
	gets_s(str);
	int count = 0;
	int len = strlen(str);
	for (int i = 0; i < len; i++)
	{
	
		
		if (i>0&&isspace(str[i-1])&&isalpha(str[i]))
		{
			count++;
		}
	}
	cout << count + 1;

}


/*
Main.cc: In function 'int main()':
Main.cc:13:12: error: 'gets_s' was not declared in this scope
  gets_s(str);
            ^
Main.cc:11:7: warning: unused variable 'a' [-Wunused-variable]
  char a[100];
       ^
Main.cc:12:6: warning: unused variable 'flag' [-Wunused-variable]
  int flag = 0;
      ^
*/

Double click to view unformatted code.


Back to problem 58