0
#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

5
Contributors
5
Replies
24
Views
2 Years
Discussion Span
Last Post by mridul.ahuja
0

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.

0

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> . . .
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.