C++大学教程(第九版)第5章練習問題5.23星号からなる菱形の図案


#include 
using namespace std;

int main() {
	for(int i = 1; i <= 5; i++) {
		for(int j = 5 - i; j > 0; j--)
			cout << ' ';
		for(int j = i * 2 - 1; j > 0; j--)
			cout << '*';
		cout << endl;
	}
	for(int i = 1; i <= 4; i++) {
		for(int j = i; j > 0; j--)
			cout << ' ';
		for(int j = 9 - 2 * i; j > 0; j--)
			cout << '*';
		cout << endl;
	}
	return 0;
}