Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <stdio.h>
- #include <cstdio>
- #include "stdAfx.h"
- using namespace std;
- int main() {
- char str[201];
- printf ("string? ");
- fgets (str, 11, stdin);
- char str1[201]; char str2[201];
- int max, test;
- test=0; max=0;
- str1=""; str2="";
- for (int i=0; ((i<200) && (str[i]!=0)); i++)
- if (str[i]!=' ') {test++; str2=str2+str[i];}
- else if (max<test) {max=test; test=0; str1=str2;}
- else {test=0; str2="";}
- printf ("%d", max);
- getchar ();
- getchar ();
- getchar ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment