Created
August 16, 2012 12:05
-
-
Save phlandscape/3369692 to your computer and use it in GitHub Desktop.
C++ solution for /r/dailyprogrammer Challenge #85 Intermediate
This file contains 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
:::::::::::::::::::/ | |
:::::::::::::::::::/+ | |
:::::::::::::::::::/++ | |
####################+++ | |
####################+++ | |
####################+++ | |
####################+++ | |
####################+++ | |
####################+++ | |
####################+++ | |
####################++ | |
####################+ | |
#################### |
This file contains 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
/* | |
http://www.reddit.com/r/dailyprogrammer/comments/xq2ao/832012_challenge_85_intermediate_3d_cuboid/ | |
*/ | |
/** | |
* #include File Doc | |
* main.cpp | |
iostream | |
* | |
*/ | |
#include <iostream> | |
using namespace std; | |
void PrintCube(int length, int height, int width){ | |
for(int i = width; i > 0; i--){ | |
for(int kk = 0; kk < i; kk++){ | |
cout << " "; | |
} | |
for(int jj = 0; jj < (length-1); jj++){ | |
cout << ":"; | |
} | |
cout << "/"; | |
for(int mm = 0; mm < (width-i); mm++){ | |
cout << "+"; | |
} | |
cout << endl; | |
} | |
for(int i = height; i > 0; i--){ | |
for(int kk = 0; kk < length; kk++){ | |
cout << "#"; | |
} | |
for(int jj = 0; jj < width; jj++){ | |
cout << "+"; | |
} | |
cout << endl; | |
} | |
for(int i = 1; i <= width; i++){ | |
for(int kk = 0; kk < length; kk++){ | |
cout << "#"; | |
} | |
for(int mm = 0; mm < (width-i); mm++){ | |
cout << "+"; | |
} | |
cout << endl; | |
} | |
} | |
int main(){ | |
PrintCube(20,10,3); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment