1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include<iostream>
#include<fstream>
#include<string>
#include<numeric>
using namespace std;
int main ()
{
string before {"30,66,70,49 ; 25,76,75,67 ; 10,58,90,62 ; 50,62,50,57 ; 40,82,60,78 ; 20,24,80,55"};
string after {"(30+66+70+49)/4 ; (25+76+75+67)/4 ; (10+58+90+62)/4 ; (50+62+50+57)/4 ; (40+82+60+78)/4 ; (20+24+80+55)/4"};
unsigned char tbl[256] {};
iota(tbl, tbl + 256, static_cast<unsigned char>(0));
cout << "The Input File is : assignments.dat" << endl;
ifstream input_file("assignments.dat");
cout << "The Output File is : yearmark.txt" << endl;
ofstream output_file("yearmark.txt");
if (!input_file || !output_file)
return (cerr << "Could not open files\n"), 1;
for (char ch {}; input_file.get(ch); output_file.put(tbl[ch]));
}
|