Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <iostream>
  2. #define N 4
  3. using namespace std;
  4. void Zapis(int a[N][N]){
  5. int count=0;
  6. for(int i=0; i<N; i++){
  7. for(int j=0; j<N; j++){
  8. a[i][j]=count;
  9. count++;
  10. }
  11. }
  12. }
  13. void ViVod(int a[N][N], int x, int y){
  14. for(int i=0; i<N; i++){
  15. for(int j=0; j<N; j++){
  16.  
  17. if(a[i][j]<10){
  18. if(i==x && j==y){
  19. cout << " (" << a[i][j] << ")";
  20. }else
  21. cout << " " << a[i][j] << " ";
  22. }
  23. if(a[i][j]>=10){
  24. if(i==x && j==y){
  25. cout << "(" << a[i][j] << ")";
  26. }else
  27. cout << " " << a[i][j] << " ";
  28. }
  29. }
  30. cout << endl;
  31. }
  32.  
  33. }
  34.  
  35. int main(){
  36. int a[N][N], x=3, y=3;
  37. bool True=1;
  38. char vvod;
  39. Zapis(a);
  40. while(True){
  41. ViVod(a,x,y);
  42. cin << vvod;
  43. True=0;
  44. }
  45. system("pause");
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement