Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. void display(char filename[], int b_map[][50], int f_map[50][50], char c_map[50][50], int width, int height)
  2. {
  3. //variables
  4. int l;
  5.  
  6. //output title
  7. cout << "-----" << filename << "-----" << endl;
  8.  
  9. if (width > 9)
  10. {
  11. //start with a blank space for formatting
  12. cout << " ";
  13. //for the entire width,
  14. for (l = 0; l < width; l++)
  15. {
  16. //if the current position is under 0, output ' '
  17. if (l <= 10)
  18. {
  19. cout << " ";
  20. }
  21. //output first line of the header
  22. else
  23. {
  24. //otherwise output position / 10 with cout
  25. cout << l / 10;
  26. }
  27.  
  28. }
  29. cout << endl;
  30. }
  31.  
  32. //start with a blank space for formatting
  33. cout << " ";
  34. //output the second line of the header
  35. for (int i = 0; i < width; i++)
  36. {
  37. //for the entire width, output position %10 with cout
  38. cout << i % 10;
  39. }
  40. cout << endl;
  41.  
  42.  
  43. //for each tile, use cout_color() to output its character and given background and foreground
  44. for (int h = 0; h < height; h++)
  45. {
  46. //at the beginning of each row, output the row number with width 2
  47. //if the current position is under 0, output ' '
  48. if (h < 10)
  49. {
  50. cout << " " << h;
  51. }
  52. else
  53. {
  54. cout << h;
  55. }
  56.  
  57. for (int w = 0; w < width; w++)
  58. {
  59. cout_color(f_map[h][w], b_map[h][w], c_map[h][w]);
  60. }
  61. cout << endl;
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement