Additions and updates in 1sem/PB
This commit is contained in:
parent
df67329dea
commit
e9d7aa3900
7 changed files with 189 additions and 7 deletions
35
1sem/programming basics/14/100.cpp
Normal file
35
1sem/programming basics/14/100.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// pb_14_100.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#define MAX_STRING 1000
|
||||
|
||||
using namespace std;
|
||||
|
||||
void my_task(istream &ist, ostream &ost);
|
||||
|
||||
int main()
|
||||
{
|
||||
ifstream inf("in.txt");
|
||||
ofstream fout("out.txt", ios::trunc);
|
||||
if (!inf.is_open() || !fout.is_open())
|
||||
{
|
||||
cerr << "Unable to open file" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
my_task(inf, fout);
|
||||
}
|
||||
|
||||
void my_task(istream &ist, ostream &ost) {
|
||||
while (!ist.eof() && ist.good()) {
|
||||
string r;
|
||||
getline(ist, r);
|
||||
size_t i;
|
||||
while ((i = r.find("YES")) != string::npos) {
|
||||
r.replace(i, 3, "NO");
|
||||
}
|
||||
ost << r << endl;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue