Advertisement
askarulytarlan

456

Nov 2nd, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <math.h>
  5.  
  6.  
  7. using namespace std;
  8.  
  9. int n;
  10. int a[100];
  11.  
  12. int main() {
  13. cout << "Welcome to Sliding Tiles!" << endl;
  14. while(true){
  15. cout << "Choose a board size [3+]:";
  16. cin >> n;
  17. cout<<endl;
  18. if(n >= 3 && n <= 4){
  19. break;
  20. }
  21. else{
  22. cout << n << " is not supported" << endl;
  23. }
  24. }
  25. while(true){
  26. cout << "Input a seed value:";
  27. cin >> n;
  28. cout << endl;
  29. if(n >= 3 && n <= 4){
  30. break;
  31. }
  32. else{
  33. cout << n << " is not supported" << endl;
  34. }
  35. }
  36.  
  37. for(int i = 1; i <= n*n; i++){
  38. cin >> a[i];
  39. }
  40. for(int i = 1; i <= n; i++){
  41. for(int j = 1; j <= n; j++){
  42. cout << " ---";
  43. }
  44. cout<<endl;
  45. for(int j = 1; j <= n; j++){
  46. cout << "| " << a[(i-1)*n+j] << " ";
  47. }
  48. cout << "|";
  49. cout << endl;
  50. }
  51. for(int j = 1; j <= n; j++){
  52. cout << " ---";
  53. }
  54. }5
  55. 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement