Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int readFile (ifstream *inFile, struct employee array[]);
  6.  
  7.  
  8. int main () {
  9. int size = 10;
  10. struct employee {
  11. string name;
  12. int id;
  13. float salary;
  14. } array[size];
  15. ifstream inFile;
  16. readFile(&inFile, array);
  17. return 0;
  18. }
  19.  
  20. int readFile (ifstream *inFile, struct employee array[]) {
  21. inFile->open("pay.txt");
  22. if(inFile->fail()) {
  23. cout << "fail";
  24. exit(1);
  25. } else {
  26. cout << "success";
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement