Please enter the number of tosses 34
Number of heads 17
Number of tails 17
Percentage of heads is 50%
Enter 'y' to play again, 'n' to quit:
y
Please enter the number of tosses 35
Number of heads 37
Number of tails 32
Percentage of heads is 105.714%
Enter 'y' to play again, 'n' to quit:
y
Please enter the number of tosses 3
Number of heads 39
Number of tails 33
Percentage of heads is 1300%
Enter 'y' to play again, 'n' to quit:
y
Please enter the number of tosses 1
Number of heads 39
Number of tails 34
Percentage of heads is 3900%
Enter 'y' to play again, 'n' to quit:
n
Since you use namespace std you can omit the std:: prefix for cout, cin and endl. Also use single quotes for single characters -> while (repeat == 'y');. To fix the problem with percent, set heads and tails to zero before the toss loop.
Please enter the number of tosses 65
Number of heads 34
Number of tails 31
Percentage of heads is 52.3077%
Enter 'y' to play again, 'n' to quit:
y
Please enter the number of tosses 43
Number of heads 52
Number of tails 56
Percentage of heads is 120.93%
Enter 'y' to play again, 'n' to quit:
n
goldenchild731@ubuntu:~/Desktop$ g++ CoinToss.cpp
goldenchild731@ubuntu:~/Desktop$ ./a.out
Please enter the number of tosses 56
Number of heads 30
Number of tails 26
Percentage of heads is 53.5714%
Enter 'y' to play again, 'n' to quit:
y
Please enter the number of tosses 45
Number of heads 19
Number of tails 26
Percentage of heads is 42.2222%
Enter 'y' to play again, 'n' to quit:
83