ПК
Size: a a a
ПК
DP
MK
DP
K
DP
ip
K
K
SK
DP
DP
FS
K
DP
FS
K
IG
#include <iostream>
#include <fstream>
using namespace std;
int main() {
string path = "text2";
ofstream inp("text2", ios::binary|ios::in);
inp.open(path);
char d;
int cnt = 0;
if (!inp.is_open()) {
cout << "Ошибка";
} else {
cout << "Успешно" << endl;
char ch;
while(!inp.eof()){
inp.write((char*)&d, sizeof d);
if(d % 2 == 0){
cnt = cnt + 1;
}
}
}
cout<<"Наш файл имеет "<<cnt<<" Четных чисел"<<endl;
inp.close();
}
SK
#include <iostream>
#include <fstream>
using namespace std;
int main() {
string path = "text2";
ofstream inp("text2", ios::binary|ios::in);
inp.open(path);
char d;
int cnt = 0;
if (!inp.is_open()) {
cout << "Ошибка";
} else {
cout << "Успешно" << endl;
char ch;
while(!inp.eof()){
inp.write((char*)&d, sizeof d);
if(d % 2 == 0){
cnt = cnt + 1;
}
}
}
cout<<"Наш файл имеет "<<cnt<<" Четных чисел"<<endl;
inp.close();
}
FS
#include <iostream>
#include <fstream>
using namespace std;
int main() {
string path = "text2";
ofstream inp("text2", ios::binary|ios::in);
inp.open(path);
char d;
int cnt = 0;
if (!inp.is_open()) {
cout << "Ошибка";
} else {
cout << "Успешно" << endl;
char ch;
while(!inp.eof()){
inp.write((char*)&d, sizeof d);
if(d % 2 == 0){
cnt = cnt + 1;
}
}
}
cout<<"Наш файл имеет "<<cnt<<" Четных чисел"<<endl;
inp.close();
}