-4

I have 3 digits (1,4,6) and I want to create a number with 2 digits from my digits like 11,14,16,41,44,46,61,64,66.

What command should I use in c++ ?

  • 4
    You will most probably need to write some code to generate this output. What have you tried so far, can you provide a code sample. – Rahul Kadukar May 22 '19 at 00:20
  • 1
    Note that without your code you will likely not get any help. ***Make a good faith attempt to solve the problem yourself first. If we can't see enough work on your part your question will likely be booed off the stage; it will be voted down and closed.*** https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions – drescherjm May 22 '19 at 00:31
  • Pretty much a duplicate of [this question](https://stackoverflow.com/q/11499807/179910). – Jerry Coffin May 22 '19 at 00:33
  • 1
    From the [help/on-topic]: *Questions asking for homework help **must include a summary of the work you've done so far to solve the problem, and a description of the difficulty you are having solving it**.* – Ken White May 22 '19 at 00:36

1 Answers1

2

There is no single command for this. You have to write the code yourself, eg:

int arr[] = {1, 4, 6};
for(int a : arr) {
    for(int b : arr) {
        cout << a << b << endl;
    }
}

Live Demo

Alternatively:

int arr[] = {1, 4, 6};
for(int a : arr) {
    for(int b : arr) {
        int value = (a * 10) + b;
        cout << value << endl;
    }
}

Live Demo

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770