Can anybody tell me why this code doesnt work?

#include <iostream>
#include <string>


using namespace std;

int simulationMenu();
int cointoss(int &win, int &loss);
void PickMarbles(char marbles[], int size);
void guessGame(int &games, int&tries);
void grandReport(char marbles, int size, int cWin, int cLoss, int rWin, int rLoss);


int simulationMenu()
{
int choice = 0;


do
{

cout << "1. Coin Toss" << endl;
cout << "2. Pick Marble" << endl;
cout << "3. Number Guessing" << endl;

cout << "Enter the number for the game you want to play" << endl;
cin >> choice;
} while (choice < 1 || choice > 3);

return choice;
}


// ================= MAIN =================
int main()
{
char more = ' ';
int choice = ' ';


do
{

choice = simulationMenu();

switch (choice)
{
case 1: cointoss;
break;
case 2: PickMarbles;
break;
case 3: guessGame;
break;
default: cout << "INVALID CHOICE" << endl;
;
}

void grandReport(char marbles, int size, int cWin, int cLoss, int rWin, int rLoss);

cout << "Would you like to play another game?" << endl; //allow user to play more
cin >> more;


} while (more == 'Y' || more == 'y');



return 0;

}

int cointoss(int &win, int &loss)
{
char more;
char coin; //user guess on Head or Tail
int r = 1 || 2; //random number 1 or 2 for Head or Tail



do
{
cout << "Call Heads or Tails (enter H or T)" << endl;
cin >> coin;

cout << "Did your coin land on heads or tails?" << endl;
cin >> coin;
} while (coin != 'H' && coin != 'T');

do
{

if (r == 1)
{
if (coin == 'H')
{
cout << "You WIN!!" << endl;

win++;

}
else
{
cout << "You LOSE!" << endl;

loss++;

}

}
else
{
if (r == 2)
{
if (coin == 'T')
{
cout << "You WIN!!" << endl;

win++;
}
else
{
cout << "You LOSE!" << endl;

loss++;
}
}

}

cout << "Do you want to flip again?" << endl;
cin >> more;


} while (more == 'Y' || more == 'N');

return win, loss;
}




//I know I dont have all the games coded here, its a team project and I dont need to code all the games
Maybe it's because you're not actually calling any functions within your switch control structure?
but when I put the cursor over cointoss, Pickmarbles or guessGame in the switch, the functions come up. I get errors if I put the whole function in the case
I don't think xismn can be any clearer. You aren't calling functions in your switch statement example above, but rather calling variables. To do functions you would do:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>

// prototype our function
int functName(int num);		

int main()
{
	std::cout << "Enter 1 to execute the function in a switch: ";
	int selection;
	std::cin >> selection;
	
	switch(selection)
	{
		case 1:
			std::cout << "Enter a number at random: ";
			int randNum;
			std::cin >> randNum;
			// two for one, you call the function
			// and print what it returns
			std::cout << "You entered: " << functName(randNum);		
		break;
		default:
			std::cout << "\nThat wasn't 1!\n";
		break;
	}
	
	return 0;
}
// function defined
int functName(int num)
{
	return num;
}
Topic archived. No new replies allowed.