#include "stdafx.h" // Header file for MS VS
#include <iostream> // Some compiler used < iostream.h>
#include <conio.h> // header file
using namespace std ;
int main()
{
char input[100] ;
int space = 0 ;
cout << "Enter a string : "
cin.getline(input , 100 , '\n') ;
for(int i = 0 ; i < 100 ; i ++)
{
if (input[i] == ' ' )
space ++ ;
}
cout << "Spaces in your enterd string : " << space ;
_getch() ;
return 0 ;
}
0 comments:
Post a Comment