Guest User

Untitled

a guest
Mar 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <windows.h>
  5. #include <sstream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     int col, row;
  12.     row = 0;
  13.     col = 0;
  14.     //table [row][col];
  15.     string table [6][2];
  16.  
  17.     fstream InFile;
  18.     InFile.open("test.txt", ios::in | ios::out);
  19.     string line;
  20.  
  21.     while(getline(InFile, line))
  22.     {
  23.         row++;
  24.         stringstream s(line);
  25.         string token;
  26.         while(getline(s, token, ' '))
  27.         {
  28.             col++;
  29.             table[row][col];
  30.         }
  31.     }
  32.  
  33.     cout <<"Rows: "<< row << endl;
  34.     cout<<"Columns: "<< col/row <<endl;
  35.     cout<<table[1][2];
  36.     InFile.close();
  37. }
Add Comment
Please, Sign In to add comment