From 93e10c62431a464fe0ace1e50ca23d155c2291e0 Mon Sep 17 00:00:00 2001 From: davas-web-designs Date: Sun, 13 Oct 2019 16:54:04 +0200 Subject: [PATCH] 162 - Tableros de Ajedrez --- acepta-el-reto/0162.cpp | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 acepta-el-reto/0162.cpp diff --git a/acepta-el-reto/0162.cpp b/acepta-el-reto/0162.cpp new file mode 100644 index 0000000..abb9336 --- /dev/null +++ b/acepta-el-reto/0162.cpp @@ -0,0 +1,51 @@ +#include + +using namespace std; + +void puntitos(int n); + +int main(){ + int n = 0; + char s; + bool t; + + cin >> n >> s; + while(n != 0){ + puntitos(n); + for(int a = 0; a < 8 * n; a++){ + if((a / n) % 2 == 0)t = true; + else t = false; + cout << "|"; + for(int i = 0; i < 8 * n; i++){ + if(t){ + if((i / n) % 2 == 0){ + cout << " "; + } + else{ + cout << s; + } + }else{ + if((i / n) % 2 == 0){ + cout << s; + }else{ + cout << " "; + } + } + + } + cout << "|" << endl; + } + puntitos(n); + cin >> n >> s; + } + + + +} +void puntitos(int n){ + cout << "|"; + for(int i = 0; i < 8 * n; i++){ + cout << "-"; + } + cout << "|" << endl; +}