Guest User

Untitled

a guest
May 27th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <cstdio>
  5. #include "stdAfx.h"
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. int main()  {
  12.  
  13.  
  14.     char str[201];
  15.     printf ("string? ");
  16.     fgets (str, 11, stdin);
  17.     char str1[201]; char str2[201];
  18.     int max, test;
  19.     test=0; max=0;
  20.     str1=""; str2="";
  21.     for (int i=0; ((i<200) && (str[i]!=0)); i++)
  22.         if (str[i]!=' ') {test++; str2=str2+str[i];}
  23.         else if (max<test) {max=test; test=0; str1=str2;}
  24.         else {test=0; str2="";}
  25.         printf ("%d", max);
  26.         getchar ();
  27.         getchar ();
  28.         getchar ();
  29.         return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment