If you can't use arrays, you'll have to mathematically find the values to print.
You have to print the text line by line. Thus it is 1, 6, 11, 16, 2, 7, 12, etc.
Each line is a simple arithmetic progression.
1 2 3 4 5
for(int line = 1; i <= 5; i++){
for(int number = line; number <= 20; number += 5)
std::cout << number << '\t';
std::cout << '\n';
}
You may want to use setw and etc. form iomanip for formatting instead of a tab.
I remember these puzzles that they used to give us in school. Damn it, I actually think I miss them.
First of all I would need to know how I'm getting the data. If it's read from a file then it could be done pretty easily: Read -> Display -> Tab -> Skip_Next_Five ->Repeat... -> Jump_To_Top -> Skip_Num_Iterations -> Read -> Display...
If the user is entering them then it gets obnoxious because you need some way to store them.
Does dynamically allocated memory count as an array in this case? It technically is, but I thought it was worth asking.