Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int A[5][6];
  7.  
  8. int Wr ( int N, int M ) {
  9. for ( int i = 1 ; i < N + 1 ; i ++ )
  10. {
  11. for ( int j = 1 ; j < M + 1 ; j ++ ) {
  12. cout << "If there is a start point here, press 0" << endl ;
  13. cout << "IF there is a easy go point, press 1" << endl ;
  14. cout << "If there is an obstacle, press 2" << endl ;
  15. cout << "If there is end point, press 3" << endl ;
  16. int cell_;
  17. cin>>cell_;
  18. if (cell_==0)
  19. A[i][j]=0;
  20. if (cell_==1)
  21. A[i][j]=N*M;
  22. if (cell_==2)
  23. A[i][j]=-1;
  24. if (cell_==3)
  25. A[i][j]=-2;
  26. }
  27.  
  28. }
  29. for (int i=0; i<N+2; i++){
  30. A[0][i]=-1;
  31. A[N+1][i]=-1;
  32. A[i][0]=-1;
  33. A[i][M+1]=-1;
  34. }
  35.  
  36.  
  37. }
  38.  
  39.  
  40. void Wave(int a, int b, int c, int d, int n){
  41. A[a][b]=n;
  42.  
  43. }
  44.  
  45.  
  46. int main()
  47. {
  48. Wr(3, 4);
  49.  
  50.  
  51. for (int i=0; i<5; i++) {
  52. for (int j=0; j<6; j++)
  53. std::cout << " " << A[i][j];
  54. std::cout << std::endl;
  55. }
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement