nazar94
22.05.2023 14:44

Решить информатику номер 212.и214​

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Ася2oo3
03.01.2022 14:59

#include <iostream>

#include <vector>

using namespace std;

int main(){

   freopen("input.txt", "r", stdin);

   freopen("output.txt", "w", stdout);

   vector<vector<int>> a;

   string s;

   while(getline(cin, s)){

       string cur = "";

       vector<int> t;

       for(int i = 0; i < s.length(); i++){

           if(s[i] == ' '){

               t.push_back(stoi(cur));

               cur.clear();

           }

           else{

               cur += s[i];

           }

       }

       if(!cur.empty())

           t.push_back(stoi(cur));

       a.push_back(t);

   }

   for(auto &i : a){

       for(auto &j : i)

           cout << j << " ";

       cout << "\n";

   }

}

0,0(0 оценок)
Ответ:
McVano
08.07.2021 18:38

#include <iostream>

#include <string>

using namespace std;

void makeLevel(int n)

{

cout << "*" << endl;

string out ="**";

for(int level=1;level<=n;++level){

  cout << out << endl;

  out.push_back('*');

}

}

void tree(int n)

{

for(int i=1;i<=n;++i){

  makeLevel(i);

}

}

{

cout << "*" << endl;

string out ="**";

for(int level=1;level<=n;++level){

  cout << out << endl;

  out.push_back('*');

}

}

void tree(int n)

{

for(int i=1;i<=n;++i){

  makeLevel(i);

}

}

int main()

{

   int n;

   cin >> n;

   tree(n);

   return 0;

}

Объяснение:

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота