c++ print 3d cube
#include <iostream>
void drawCube() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
for (int k = 0; k < 3; ++k) {
if (i == 1 && j == 1 && k == 1)
std::cout << " "; // Empty space at the center of the cube
else
std::cout << "* "; // Print asterisk for the cube's edges
}
std::cout << std::endl;
}
std::cout << std::endl; // Separate layers of the cube
}
}
int main() {
drawCube();
return 0;
}