Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- #include <math.h>
- using namespace std;
- int n;
- int a[100];
- int main() {
- cout << "Welcome to Sliding Tiles!" << endl;
- while(true){
- cout << "Choose a board size [3+]:";
- cin >> n;
- cout<<endl;
- if(n >= 3 && n <= 4){
- break;
- }
- else{
- cout << n << " is not supported" << endl;
- }
- }
- while(true){
- cout << "Input a seed value:";
- cin >> n;
- cout << endl;
- if(n >= 3 && n <= 4){
- break;
- }
- else{
- cout << n << " is not supported" << endl;
- }
- }
- for(int i = 1; i <= n*n; i++){
- cin >> a[i];
- }
- for(int i = 1; i <= n; i++){
- for(int j = 1; j <= n; j++){
- cout << " ---";
- }
- cout<<endl;
- for(int j = 1; j <= n; j++){
- cout << "| " << a[(i-1)*n+j] << " ";
- }
- cout << "|";
- cout << endl;
- }
- for(int j = 1; j <= n; j++){
- cout << " ---";
- }
- }5
- 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement