- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
#include "pch.h"
#include <iostream>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <fstream>
#include <string>
using namespace std;
int main()
{
setlocale(0, "rus");
fstream filein("C://test.txt");
fstream fileout("C://answers.txt");
fileout << "ваши ответы:\n";
int control = 0, k = 0, right=0, wrong=0;
string ans, right_ans, a;
if (!filein) {
cout << "еррор, файл с тестом не открыт/не найден";
return 0;
}
getline(filein, a);
cout << a << endl;
fileout << a <<endl;
getline(filein, a);
cout << a<<endl;
for (string s; !filein.eof();) {
getline(filein, s);
cout << s <<endl;
getline(filein, s);
do {
cout << " " << s << endl;
getline(filein, s);
} while (s!="\0");
cout << "ваш ответ: "; cin >> ans;
getline(filein, s);
right_ans=s.erase(0, 6);
if (ans == right_ans) {
cout << "верно" << endl;
right += 1;
}
else {
cout << "неверно, правильный ответ: " << right_ans << endl;
wrong += 1;
}
cout << endl;
fileout << ans << endl;
getline(filein, s); cout << s;
}
cout << "правильные ответы: " << right << " из " << wrong+right << endl;
filein.close();
fileout.close();
_getch();
return 0;
}
Школьный проект.
НЕ ЧИТАТЬ!!
УБЬЕТ!!