Created
July 31, 2016 12:16
-
-
Save kakikubo/c2418f940598c1e6dd9f73f791408019 to your computer and use it in GitHub Desktop.
ロジックのお勉強ですよ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using std::cin; | |
using std::cout; | |
/** | |
* g++ hash.cpp -o hash | |
*/ | |
int main(int argc, char const* argv[]){ | |
// こんなんが出来る | |
// ##### | |
// ##### | |
// ##### | |
// ##### | |
// ##### | |
for (int row = 1; row <= 5; row++){ | |
for (int hash = 1; hash <= 5 ; hash++){ | |
cout << "#"; | |
} | |
cout << "\n"; | |
} | |
cout << "\n"; | |
// こんなんが出来る | |
// ##### | |
// #### | |
// ### | |
// ## | |
// # | |
for (int row = 1; row <= 5; row++){ | |
for (int hash = 1; hash <= (6 - row) ; hash++){ | |
cout << "#"; | |
} | |
cout << "\n"; | |
} | |
cout << "\n"; | |
// こんなんが出来る | |
// # | |
// ## | |
// ### | |
// ## | |
// # | |
for (int row = 1; row <= 5; row++){ | |
for (int hash = 1; hash <= (3 - abs(3 - row)) ; hash++){ | |
cout << "#"; | |
} | |
cout << "\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment