Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <cstdlib>
  4. #include <stdio.h>
  5. #include <time.h>
  6. #include <algorithm>
  7. #include <math.h>
  8. #include <conio.h>
  9. #include <fstream>
  10.  
  11. using namespace std;
  12.  
  13. char wybor;
  14. string zdanie;
  15. string szukaj;
  16. string usun;
  17. string dopisz;
  18. int pozycja;
  19.  
  20. int main()
  21. {
  22. cout << "Wpisz jakies Zdanie: ";
  23. getline(cin,zdanie);
  24. system("cls");
  25. cout << "Zdanie: " << zdanie << endl;
  26. cout << "\n";
  27. cout << "Co chcesz zrobic?" << endl;
  28. cout << "[1] Znalezc slowo w tym Zdaniu" << endl;
  29. cout << "[2] Usunac slowo z tego Zdania" << endl;
  30. cout << "[3] Dopisac slowo do tego Zdania" << endl;
  31. wybor=getch();
  32. switch(wybor)
  33. {
  34. case '1':
  35. system("cls");
  36. cout << "Jakie slowo chcesz Znalezc: ";
  37. getline(cin,szukaj);
  38. system("cls");
  39. cout << "Slowo do Znalezienia: " << szukaj << endl;
  40. pozycja=zdanie.find(szukaj);
  41. if(pozycja!=string::npos)
  42. {
  43. cout << "Znaleziono na Pozycji: " << pozycja;
  44. } else cout << "Nie znaleziono slowa: " << szukaj;
  45. break;
  46. case '2':
  47. system("cls");
  48. cout << "Jakie slowo chcesz Usunac: ";
  49. getline(cin,usun);
  50. system("cls");
  51. cout << "Slowo do Usuniecia: " << usun << endl;
  52. pozycja=zdanie.find(usun);
  53. if(pozycja!=string::npos)
  54. {
  55. cout << "Znaleziono slowo do usuniecia" << usun << endl;
  56. } else cout << "Nie znaleziono slowa: " << usun << endl;
  57.  
  58. break;
  59. case '3':
  60. cout << "opcja 3" << endl;
  61. break;
  62. default:
  63. cout << "\n";
  64. cout << "Nie ma takiego Wyboru!" << endl;
  65. cout << "Sprobuj Ponownie!" << endl;
  66. }
  67.  
  68. getchar();getchar();
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement