Advertisement
naskedvi

T5 - zad.1.

Mar 30th, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. char recenica[100];
  6. std::cout << "Unesi recenicu: "<<std::endl;
  7. std::cin.getline(recenica, sizeof recenica);
  8. char *pok(recenica);
  9.  
  10. bool nasao_rijec(false);
  11.  
  12. while(*pok!='\0' && *pok!='\n')
  13. {
  14. if(*pok==' ')
  15. {
  16. if(nasao_rijec)
  17. {
  18. do { pok++; }
  19. while(*pok==' ');
  20.  
  21. if(*pok!=' ')
  22. {
  23. while(*pok!='\0' && *pok!='\n')
  24. {
  25. std::cout<<*pok;
  26. pok++;
  27. }
  28. }
  29. }
  30. else
  31. {
  32. pok++;
  33. continue;
  34. }
  35. }
  36. else
  37. {
  38. nasao_rijec=true;
  39. pok++;
  40. }
  41. }
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement