Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <iomanip>
- using namespace std;
- #include "class.h"
- const int x = 14;
- int main()
- {
- ifstream infile;
- ofstream outfile;
- infile.open("Text.txt");
- outfile.open("outfile.txt");
- record data[100];
- int i = 0;
- string a, b;
- double c, d;
- outfile << setprecision(10);
- while (infile)
- {
- getline(infile, a);
- getline(infile, b);
- infile >> c >> d;
- infile.ignore(100, '\n');
- if (data[i].load(a, b, c, d))
- {
- i++;
- }
- }
- for (int j = 0; j < i; j++)
- {
- data[j].retriveData(a, b, c, d);
- outfile << setw(x) << a << setw(x) << b
- << setw(x) << c << setw(x) << d << endl;
- }
- for (int z = 0; z < i; z++)
- {
- for (int y = 0; y < i; y++)
- {
- if (data[z].getId() < data[y].getId())
- {
- swap(data[z], data[y]);
- }
- }
- }
- outfile << endl << endl;
- for (int j = 0; j < i; j++)
- {
- data[j].retriveData(a, b, c, d);
- outfile << setw(x) << a << setw(x) << b
- << setw(x) << c << setw(x) << d << endl;
- }
- infile.close();
- outfile.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement