Advertisement
powerunlimited

Untitled

Dec 26th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 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<<endl;
  13.     if(strlen(Q1) > 1)
  14.         Q = Q1;
  15.     for(i=0; i<100; i++)
  16.     {
  17.         if (Q[i]=='\0')
  18.             break;
  19.         string a;
  20.         if (isalpha(Q[i]))
  21.         {
  22.             for(j=i; j<100; j++)
  23.             {
  24.                 if (isdigit(Q[j])||(ispunct(Q[j])&&Q[j]!='-'))
  25.                     continue;
  26.                 a=a+Q[j];
  27.                 if (isspace(Q[j]))
  28.                 {
  29.                     cout<<++n<<". : ["<<a<<"]"<<endl;
  30.                     i=j;
  31.                     break;
  32.                 }
  33.  
  34.             }
  35.  
  36.         }
  37.  
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement