Code:#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
int randrange(int low, int high){
return rand()%(high-low+1)+low;
}
int main(){
int a;
srand(time(NULL));
a = randrange(1,2);
for ( int i=0;i<10; ++i)
{
cout<<randrange(1,2)<<'\n';
switch (a){
case 1:
cout<<"heads\n";
break;
case 2:
cout<<"tails\n";
break;
}
}
}
i dont understand why it keep printing heads but not tails even when the random number is 2?