Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "");
- cout << "Mata in en text: ";
- string text;
- getline(cin, text);
- cout << "\nMata in ordet du vill hitta i texten: ";
- string ord;
- cin >> ord;
- int pos = text.find(ord, 0);
- if (pos < 0) {
- cout << "Ordet finns inte med i texten." << endl;
- }
- else {
- cout << "Ordet finns med i texten." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement