answer (Треугольник из " * " и " + " БЕЗ массива)

#include "stdafx.h"//del #include <iostream> using namespace std; int main() { int N = 0; while (true) { cout << "N ="; cin >> N; if (N < 2) cout << endl << "Not corect N. N > 1!"; else break; } int SELECT = 0;//+ for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if ((i >= j) && (SELECT == 0)) { cout << "+"; SELECT = 1; } else if ((i >= j) && (SELECT == 1)) { cout << "*"; SELECT = 0; } else cout << " "; } cout << endl; } return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.