Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <cstdlib>
- #include <stdio.h>
- #include <time.h>
- #include <algorithm>
- #include <math.h>
- #include <conio.h>
- #include <fstream>
- using namespace std;
- char wybor;
- string zdanie;
- string szukaj;
- string usun;
- string dopisz;
- int pozycja;
- int main()
- {
- cout << "Wpisz jakies Zdanie: ";
- getline(cin,zdanie);
- system("cls");
- cout << "Zdanie: " << zdanie << endl;
- cout << "\n";
- cout << "Co chcesz zrobic?" << endl;
- cout << "[1] Znalezc slowo w tym Zdaniu" << endl;
- cout << "[2] Usunac slowo z tego Zdania" << endl;
- cout << "[3] Dopisac slowo do tego Zdania" << endl;
- wybor=getch();
- switch(wybor)
- {
- case '1':
- system("cls");
- cout << "Jakie slowo chcesz Znalezc: ";
- getline(cin,szukaj);
- system("cls");
- cout << "Slowo do Znalezienia: " << szukaj << endl;
- pozycja=zdanie.find(szukaj);
- if(pozycja!=string::npos)
- {
- cout << "Znaleziono na Pozycji: " << pozycja;
- } else cout << "Nie znaleziono slowa: " << szukaj;
- break;
- case '2':
- system("cls");
- cout << "Jakie slowo chcesz Usunac: ";
- getline(cin,usun);
- system("cls");
- cout << "Slowo do Usuniecia: " << usun << endl;
- pozycja=zdanie.find(usun);
- if(pozycja!=string::npos)
- {
- cout << "Znaleziono slowo do usuniecia" << usun << endl;
- } else cout << "Nie znaleziono slowa: " << usun << endl;
- break;
- case '3':
- cout << "opcja 3" << endl;
- break;
- default:
- cout << "\n";
- cout << "Nie ma takiego Wyboru!" << endl;
- cout << "Sprobuj Ponownie!" << endl;
- }
- getchar();getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement