mercredi 3 novembre 2021

How to Repeat an integer multiple times in C++

#include <iostream>
#define el '\n'
using namespace std;

int main(){
    int T;
    int i;
    cin >> T;
    int N[i];
    for(int i=0; i < T; i++){
        cin >> N[i];
    }
    for(int i=0 ; i < T ;i++){
        cout << N[i] << el;

    }

}

If the input is: 3 3 4 6

I need the output to be: 3 3 3 4 4 4 4 6 6 6 6 6 6

what is the change I can make for the 14th line to solve the problem?

Aucun commentaire:

Enregistrer un commentaire