Advertisement
Guest User

c++

a guest
Apr 17th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include <string>
  4. #include <iomanip>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. int main(){
  10. cout<<"hey"<<endl;
  11. ifstream inputFile("trevortesttext.txt");
  12. int mazeH = 0;
  13. int mazeW = 0;
  14. int s;
  15.  
  16.  
  17. inputFile >> mazeH;
  18. inputFile >> mazeW;
  19.  
  20. vector<vector<char>> maze (mazeH);
  21.  
  22. cout<<mazeH<<endl;
  23. cout<<mazeW<<endl;
  24.  
  25. for(int i = 0; i < mazeH; i++)
  26. maze[i] = vector<char>(mazeW);
  27.  
  28. cout << maze.size()<<endl;
  29. cout << maze[0].size()<<endl;
  30. for (int row = 0;row < mazeH; row++)
  31. {
  32. for (int col = 0; col < mazeW; col++)
  33. {
  34. if (inputFile.peek() == '\n')
  35. inputFile.get();
  36.  
  37. maze[row][col] = inputFile.get();
  38. }
  39. }
  40.  
  41.  
  42. for (int col = 0; col < mazeW; col++) //////////////TO TEST PRINT
  43. {
  44. for (int row = 0; row < mazeH; row++)
  45. {
  46. cout << maze[row][col] << " ";
  47. }
  48.  
  49. cout << endl;
  50. }
  51. cin>>s;
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement