Void function reset
Apr 28, 2020 at 6:55pm UTC
Is there a way to set up a reset code using void to jump back up in place after a certain line of code is implemented? I was going to use GoTo, however, that is cancer so I was wondering if anyone could give me an example.
Apr 28, 2020 at 7:12pm UTC
Please show an example of the case you mean.
Apr 28, 2020 at 7:22pm UTC
Its for the setup for the actions end of this chunk of code:
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
std::cout << "Dungeons And Dragons Helpful Rolling Application. (If you are going to roll for advantage or disadvantage please roll two dice.) Please input the action you are doing: " << std::endl << "Run=r" << std::endl << "action=a" << std::endl << "check=c" << std::endl << "investigation=i"
<< std::endl << "cantrip=p" << std::endl << "spell= s" << std::endl << "attack=t" << std::endl;
std::string input;
std::cin >> input;
do
{
if (input == "r" )
{
std::cout << "Please tell the DM your movement location." << std::endl;
input = "a" ;
}
else if (input == "c" || input == "i" )
{
std::cout << "Please tell the DM what you are inspecting: " << std::endl;
rollDice();
//reset to top here
}
else if (input != "r" || input != "a" )
{
if (input == "c" || input == "s" )
{
std::cout << "Please tell the DM which spell or cantrip you are using: " << std::endl;
rollDice();
//reset to top here
}
if (input == "t" )
{
std::cout << "what arer you waiting for attack!" << std::endl;
rollDice();
}
/*
{if (input == "saving throw")
{
std::cout << "what modifier type are you adding to your rolls?" << std::endl;
std::cin >>
}
if (input =="sexy time"
{
std::out << "You fail you fucking bard!"
}
*/
}
} while (input == "r" || input == "a" || input == "s" || input == "c" || input == "t" || input == "e" || input == "i" || input == "c" );
}
Apr 28, 2020 at 7:48pm UTC
"continue"
Topic archived. No new replies allowed.