Positioning Functions

I want to display these two functions as two columns next to each other.
Ex: Column1 Column2
8 9
10 11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

void Heading ();
void K ();

int main()
{
    Heading ();
    K ();
	cout << "\n\n\n\t\t\t   "; return 0;
}

void Heading ()
{
	cout << "\n\t\t   any text\n";
	cout << "\t\t\t\t any text\n";
	cout << "\n\t\t\t\t    any text\n";
}

void K ()
{
	int k;
	cout << "K\n\n";
	k = 0;		
	while ( k < 14 )
	{
		cout << right << setw (3) << k+1 << endl;
		k++;
	}
	cout << right << setw (3) << k+1;
Last edited on
The output in your functions are all over the place. Regardless, it would be impossible to put those two functions side by side because you're creating a new line every time a number is output in your K function. I would suggest getting rid of your "Heading" function and just adding tabs in your K function before the line is ended to allow for values to be input in a column next to it.
I can't get rid of the "Heading" function (my teacher wants two functions). Is there any other solution.
Topic archived. No new replies allowed.