Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. // ConsoleApplication5.cpp: archivo de proyecto principal.
  2.  
  3. #include "stdafx.h"
  4. #include "iostream"
  5.  
  6.  
  7. using namespace std;
  8.  
  9. void main()
  10. {
  11. int *n = new int;
  12. int *diagonal = new int;
  13. int *cruz = new int;
  14.  
  15.  
  16. cout << "Introduzca las filas: ";cin >> *n;
  17. *diagonal = (*n);
  18. *cruz = 0;
  19. //cout << "Introduzca las columnas: ";cin >> *columnas;
  20.  
  21.  
  22.  
  23.  
  24.  
  25. for(int filas=1; filas <= *n; filas++) {
  26.  
  27. for (int columnas=1; columnas <= *n; columnas++) {
  28. if (filas == 1 || filas == *n || columnas == 1 || columnas == *n || columnas == *diagonal || columnas == filas || columnas == (*n/2 + 1) || filas == (*n / 2 + 1))
  29. cout <<"*";
  30. else
  31. cout << " ";
  32. }
  33. cout << endl;
  34. (*diagonal)--;
  35.  
  36. }
  37.  
  38. system("pause>null");
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement