SHARE
TWEET

Untitled

a guest Oct 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. draft
  3. */
  4.  
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <fstream>
  8. #include <string>
  9.  
  10. using namespace std;
  11.  
  12. const int ROWS = 15;
  13. const int COLS = 30;
  14. const char EMPTY = '*';
  15. const char TAKEN = '#';
  16.  
  17. void loadSeats(char[ROWS][COLS]);
  18.  
  19. int main()
  20. {
  21.     char seats[ROWS][COLS];
  22.     loadSeats(seats);
  23.  
  24.    
  25.  
  26.  
  27.  
  28.     return 0;
  29. }
  30.  
  31. void loadSeats(char seats[ROWS][COLS])
  32. {
  33.     char seatingChart[ROWS][COLS];
  34.  
  35.     string fileName = "seatingChart.dat";
  36.     ifstream inFile;
  37.    
  38.     inFile.open(fileName);
  39.  
  40.     if (inFile)
  41.     {
  42.         for (int x = 0; x < ROWS; x++)
  43.             for (int y = 0; y < COLS; y++)
  44.             {
  45.                 inFile >> seatingChart[x][y];
  46.             }
  47.         inFile.close();
  48.     }
  49.     else
  50.     {
  51.         cout << "Could not fine seatingChart.dat creating new file." << endl;
  52.  
  53.         ofstream outFile;
  54.         outFile.open(fileName);
  55.  
  56.         //seatingChart[ROWS][COLS] = EMPTY;
  57.         for (int x = 0; x < ROWS; x++)
  58.            
  59.             for (int y = 0; y < COLS; y++)
  60.                
  61.                 outFile << seatingChart[x][y];
  62.  
  63.         //outFile << seatingChart[][y];
  64.  
  65.         outFile.close();
  66.     }
  67.     cout << "end";
  68. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top