Facebook
From Colorant Ibis, 3 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 77
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. #include <ctime>
  5. #include <fstream>
  6. #include <string>
  7. #include <errno.h>
  8. using namespace std;
  9. struct menuItemType
  10. {
  11.         string menuItem;
  12.         double menuPrice;
  13. };
  14. //void getData (menuItemType menuList[])
  15. int main()
  16. {
  17.         string line;
  18.         char buff[256];
  19.         ifstream myfile("C:/Users/jdsho/source/repos/CSC 211/Lab 8/menu.txt");
  20.        
  21.         if (!myfile)
  22.         {
  23.                 strerror_s(buff, 100, errno);
  24.                 cout << buff << endl;
  25.                 cout << "ERROR" << endl;
  26.         }
  27.  
  28.         if (myfile.is_open())
  29.         {
  30.                 while (getline(myfile, line))
  31.                 {
  32.                         if (line == "END") break;
  33.                         cout << line << endl;
  34.                 }
  35.                 myfile.close();
  36.         }
  37.  
  38.        
  39.        
  40.  
  41.  
  42.  
  43.        
  44. }