every time i run this code it skips to the part where it prompts the user if they would like to go again i don't know why it skips the function call and it doesn't give any errors when compiling greatly appreciate any help given
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
usingnamespace std;
int main (){
srand(time(NULL));
string PLAY_AGAIN = "yes";
string RNG_GUESS();
do{
string USER_VS_COMPUTER (string RNG_GUESS()); // the problem appears to be here
cout << "you would like to play ultimate coin toss simulator.(again?)"; // this prompt and the next cin are looped without running the two functions
cin >> PLAY_AGAIN;
}
while (PLAY_AGAIN == "yes");
}
string RNG_GUESS (){
int RNG_NUMBER = (rand() % 100) * 100;
if (RNG_NUMBER < 50){
return"heads";
}
elseif (RNG_NUMBER > 50){
return"tails";
}
else {
return"your rng number is too high or too low fix it"; // error to test if my rng gave the correct range of outputs
};
}
string USER_VS_COMPUTER (string RNG_GUESS()){
string USER_INPUT = "q";
cout << "please guess either t (tails) or h (heads).";
cin >> USER_INPUT;
if (USER_INPUT == "h" && RNG_GUESS() == "heads"){
cout << "you win";
}
elseif(USER_INPUT == "t" && RNG_GUESS() == "tails"){
cout << "you win";
}
else {
cout << "you lose sorry";
}
};
string USER_VS_COMPUTER (string RNG_GUESS());
Declare USER_VS_COMPUTER as function
Taking a single parameter named RNG_GUESS
which is a function
witout parameters
returning string
Returng string
This is no a function call, but function declaration.