powerunlimited

Untitled

Dec 26th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <cctype>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int i,j,n=0 ;
  9.     char    Q1[100];
  10.     string  Q = "Must you be so linear, Jean-Luc 0 123";
  11.     cin.getline(Q1, 99);
  12.     cout<<endl;
  13.     if(strlen(Q1) > 1)
  14.         Q = Q1;
  15.     for(i=0; i<100; i++)
  16.     {
  17.         string a;
  18.         if (isalpha(Q[i]))
  19.         {
  20.             for(j=i; j<100; j++)
  21.             {
  22.                 if (isdigit(Q[j])||(ispunct(Q[j])&&Q[j]!='-'))
  23.                     continue;
  24.                 if (isspace(Q[j])||Q[j]=='\0')
  25.                 {
  26.                     cout<<++n<<". : [ "<<a<<" ]"<<endl;
  27.                     i=j;
  28.                     break;
  29.  
  30.                 }
  31.                 a=a+Q[j];
  32.             }
  33.  
  34.         }
  35.         if (Q[i]=='\0')
  36.             break;
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment