Hello people I'm new to this forum and only been suing c++ / c for a little while now. I'm trying to seek out help with a program. I've written some of the code:
....................................................................................................
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdlib>
using std::cin;
using std::cout;
using std::endl;
using std::setw;
int main()
{
srand(time(0));
for (int counter = 0; counter <=10; counter ++)
{
cout << setw(4) << (1 + rand()%2)
<<endl;
if
}
return 0;
}
......................................................................................................
however has you can see it either prints out a 1 or 2. Basically I would like it to print out a Heads or a Tails depending on which number is randomized.
So either 1 prints out heads and do doesnt.
I've tried creating and if else statement but it seems that I'll need somewhere to store the number then the loop fails... Any ideas?