Top.Mail.Ru
Ответы

Диф зачет по информатике на языке С++

По дате
По рейтингу
Аватар пользователя
Новичок

Держи:

12345678910111213141516171819202122
 #include <iostream>
#include <cstdlib>

using namespace std;

void print(ostream &o, char c, unsigned short n) {
    for (unsigned short j = 0; j < n; j++)
        o << c;
}

int main() {
    srand(time(NULL));
    const unsigned short n = rand() % 98 + 3;
    for (unsigned short i = 0; i < n; i++) {
        print(cout, '*', n - i);
        print(cout, '^', i * 2 + 1);
        print(cout, '*', n - i);
        cout << endl;
    }

    return 0;
}