1234567891011121314151617181920212223242526272829303132333435363738
#include "stdafx.h" #include <iostream> #include "Employee.h" #include <fstream> #include <string> #include <iomanip> using namespace std; int main() { int iD, iD2, iD3 = 0; string name, position, department; string name2, pos2, dep2; string name3, pos3, dep3; int i; const int size = 3; ifstream file; file.open("data.txt"); if (file.good()) { file >> name >> iD >> department >> position >> name2 >> dep2 >> pos2 >> name3 >> dep3 >> pos3; } else { cout << "Cannot open file" << endl; } Employee line1; line1.Setname(name); line1.SetNumber(iD); line1.SetDepart(department); line1.SetPosition(position); system("pause"); return 0; }
file.open("C:/Some/directory/data.txt");
/