Hello from what i can understand about function is that you need the prototype , then you need some kind of call function in the program and then the delcared function. Well I've done that but it doesnt want to work :(
#include
#include
#include
using namespace std; // for std::cin, std::cout etc.
void f1();
int main()
{
int cointoss, heads = 0, tails = 0;
srand(time(0));
for (int counter = 0; counter <= 10; counter++)
{
cointoss = 1 + rand() % 2;
if (cointoss == 1)
{
cout << "Heads" << endl;
heads++;
}
else
{
cout << "Tails" << endl;
tails++;
}
}
cout << "there are a total of " << heads << " heads";
cout << " and " << tails << " tails" << endl;
f1();
cin.get(); // wait
return 0;
}
void f1(int i)
{
return heads - tails;
}
basically the function is ment to take the total of Heads and takewaya the total tails, stored at int tails and int heads but it doesnt want to excuted!
Would be reatful for assistance.