[cpp]
#include <cstdlib>
#include <iostream>
using namespace std;
int main(void)
{
int count, i, heads = 0, tails = 0;
float number;
cout << "Parayi Kac Kere Atacaksiniz: ";
cin >> count;
srand(time(NULL));
for (i = 1 ; i <= count ; i++) {
number = (float)rand () / RAND_MAX;
if (number < 0.5) {
cout << "Tura" << " " << i << ". Atis"<< endl;
heads++;}
else {
cout << "Yazi" << " " << i << ". Atis"<< endl;
tails ++;
}
}
cout << "Yazi Sayisi: " << tails << ", Yuzdesi " << (float)tails / (float)count * 100.0 << endl;
cout << "Tura Sayisi: " << heads << ", Yuzdesi " << (float)heads / (float)count * 100.0 << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
[/cpp]