Darksider3

Untitled

Mar 2nd, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4. int main(int argc,char ** argv)
  5. {
  6. if(*argv[1] == 0)
  7.     {
  8.         cout << "Keine Zeichenkette gegeben";
  9.         return 1;
  10.     }
  11.     int ln = strlen(argv[1]);
  12.     int anzahl=0;
  13.     char po = ' ';
  14.     for(int x=0;x < ln;x++)
  15.     {
  16.         if(argv[1][x] == po)
  17.         {
  18.             if(argv[1][x+1] == po)
  19.             {
  20.                 x++;
  21.                 continue;
  22.             }
  23.             anzahl++;
  24.         }
  25.     }
  26.     anzahl++;
  27.     cout << anzahl;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment