Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <conio.h>
- #include <iomanip>
- #include <iostream>
- #include <stdio.h>
- #include <time.h>
- #include <string>
- #include <windows.h>
- #include <clocale>
- #include <cmath>
- #include <fstream>
- using namespace std;
- bool pr(char s);
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- ifstream fin;
- ofstream fout;
- string s,p;
- fin.open("in.txt");
- getline(fin,s);
- s = s + ",";
- getline(fin,p);
- fin.close();
- fout.open("out.txt");
- fout<<"21. Из заданной последовательности слов, разделенных запятыми, удалить слова, содержащие введенную с клавиатуры последовательность символов.\n\n";
- fout<<"\nВаш текст:\n"<<s;
- string temp;
- string otvet="";
- for(int i =0; i<s.size(); i++){
- int pos = -1;
- if ((s[i]==',')){
- pos = temp.find(p);
- if (pos < 0){
- otvet = otvet + temp;
- }
- temp = " ";
- }
- temp = temp + s[i];
- }
- fout<<endl<<otvet<<endl;
- fout<<endl<<endl<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement