#include<iostream>
#include<cstdlib>
using namespace std;

int main()
{
    srand(21);

    cout << "Unique numbers:";
    for (int x = 1; x < 10; x++){
        cout << 1 + ( rand () % 20) <<endl;
    }
    system("pause>0");
    return 0;
}

Guys this is my program. Can i ask if how can i vertical the output? what will i used? thanks

Recommended Answers

All 5 Replies

What do you mean by "vertical the output"?

please rephrase your question or what you need be done.

i mean the output should be vertical direction

i mean the output should be vertical direction

Which means what, exactly? Show us an example, because right now each number is output on a separate line, and that looks a lot like 'vertical' to me.

The line cout << 1 + ( rand () % 20) <<endl; will give an output like :

<random_number_1>
<random_number_2>
<random_number_3>
.
.

which is already vertical. If you by chance want the output to be in a single line, replace this line with cout << 1 + ( rand () % 20) <<" ";

This will give you an output like :

<random_number_1> <random_number_2> <random_number_3> . . .
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.