i have problem with my code. the program should print tab backwards but it gives also additional numbers example:
7 6 8 7 2 1 6 1 2 7 8 6 7
#include<iostream>
#include<ctime>
int main()
{
using namespace std;
srand(time(nullptr));
int tab[6];
for (int i = 0; i < 6; i++)
{
tab[i] = rand() % 8 + 1;
cout << " " << " " << tab[i];
}
cout << " ";
for (int i = 6; i >= 0; i--)
{
cout << " " << tab[i];
}