Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. void readMap()
  2. {
  3. string name = "firstLoc.txt";
  4. ifstream firstLoc(name);
  5. char **map_Matrix = new char*[10];
  6. for (int i = 0; i < 10; i++)
  7. {
  8. map_Matrix[i] = new char[5];
  9. }
  10. if (!firstLoc.is_open())
  11. {
  12. cout << "File not open. \n";
  13. }
  14. else
  15. {
  16.  
  17. while (!EOF)
  18. {
  19. for (int i = 0; i < 5; i++)
  20. {
  21. for (int j = 0; j < 10; j++)
  22. {
  23. firstLoc >> map_Matrix[i][j];
  24. }
  25. }
  26.  
  27. }
  28. for (int i = 0; i < 5; i++)
  29. {
  30. for (int j = 0; j < 10; j++)
  31. {
  32. cout << setw(3) << setprecision(1) << map_Matrix[i][j];
  33. }
  34. cout << endl;
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement