Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. struct sleepRecord {
  7.     int dayStart;
  8.     int monthStart;
  9.     int yrStart;
  10.     int hrStart;
  11.     int minStart;
  12.     int secStart;
  13.     int dayEnd;
  14.     int monthEnd;
  15.     int yrEnd;
  16.     int hrEnd;
  17.     int minEnd;
  18.     int secEnd;
  19. };
  20.  
  21. struct playerType {
  22.     int pNum;
  23.     string pName;
  24.     sleepRecord r[31];
  25. };
  26.  
  27.  
  28.  
  29.  
  30. int main() {
  31.     ifstream inFile;
  32.     string fName, line1;
  33.     char line2[256];
  34.     playerType players[99];
  35.  
  36.     cout << "Enter file name: ";
  37.     cin >> fName;
  38.  
  39.     inFile.open(fName);
  40.  
  41.     if(inFile.is_open()) {
  42.             while(getline(inFile, line1)) {
  43.                 inFile.getline(line2, 256);
  44. /*                sscanf(line2, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s", &[0].dayStart, &r[0].monthStart,
  45.                            &r[0].yrStart, &r[0].hrStart, &r[0].minStart, &r[0].secStart,
  46.                            &r[0].dayEnd, &r[0].monthEnd, &r[0].yrEnd, &r[0].hrEnd,
  47.                            &r[0].minEnd, &r[0].secEnd);
  48.  
  49.                 printf("%d/%d/%d %d:%d:%d %d/%d/%d %d:%d:%d", dayStart, monthStart, yrStart, hrStart, minStart, secStart,
  50.                                                                   dayEnd, monthEnd, yrEnd, hrEnd, minEnd, secEnd);
  51.  
  52.             } */
  53.             inFile.close();
  54.     } else {
  55.         cout << "Unable to open file";
  56.         return -1;
  57.     }
  58.  
  59.     return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement