I need to be able to have spaces come up between each number. Here is my code. Any help would be awesome! This app allows you too have 6 rows of 6 numbers generated for your insta pick numbers between 1 – 49, it has to pick two rows of 6 numbers, 1 – 49 for twist and 1 row of 6 numbers for tag.
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main()
{
{
cout << "*** LOTTO MAX INSTA PICK ***" << endl;
cout<< " " << endl << endl;
}
{
cout << "Your Insta Pick Numbers" << endl;
cout<< " " << endl << endl;
}
for (int counter = 1; counter <= 24; ++ counter)
{
cout << setw(1) << (1 + rand() % 49);
if (counter % 6 == 0)
cout << endl;
}
{
cout<< " " << endl << endl;
cout<< " " << endl << endl;
}
{
cout << "Your Twist Numbers" << endl;
cout<< " " << endl << endl;
}
for (int counter = 1; counter <= 12; ++ counter)
{
cout << setw(1) << (1 + rand() % 49) , " ";
if (counter % 6 == 0)
cout << endl;
}
{
cout<< " " << endl << endl;
cout<< " " << endl << endl;
}
{
cout << "Your Tag Numbers" << endl;
cout<< " " << endl << endl;
}
for (int counter = 1; counter <= 6; ++ counter)
{
cout << setw(1) << (1 + rand() % 12);
if (counter % 6 == 0)
cout << endl;
}
{
cout<< " " << endl << endl;
cout<< " " << endl << endl;
}
{
cout << "Thank you for playing!! please check ticket a year minus a day from date of purchase" <<endl;
}
};
You almost had it when you did
but that doesn’t do what you think it does. It evaluates two expressions, separated by a comma –
cout << setw(1) << (1 + rand() % 49)and" ". The first does thesetwand prints(1 + rand() % 49), and the second one just evaluates to itself and has no effect. Remember that<<is the output operator forcout, so you just need to change the comma to a<<:The same thing goes for the other places you are printing numbers.