#include "stdafx.h"
#include <iostream>
#include <string>
void WorldBuilder();
bool Acceptor();
int main()
{
bool IsAcceptable = (false);
while (IsAcceptable == (false))
{
WorldBuilder(); // build world
IsAcceptable = Acceptor();
}
return 0;
}
// Builds the world
void WorldBuilder()
{
std::cout << "Building World...\n";
return;
}
bool Acceptor()
{
std::cout << "Is world build acceptable? (y/n) ";
std::string qIsAcceptable = "";
std::cin >> qIsAcceptable;
if (qIsAcceptable[1] == 'y')
{
return (true);
}
else if (qIsAcceptable[1] == 'n')
{
return (false);
}
}
Wenn ich debuggen es aus dem Elses geht, ohne die isAcceptable boolean verändert und geht zurück auf Worldbuilder() und boolean Fahrten auf true was die Eingabe.Ich habe Probleme mit einem boolean Acceptor
Ich habe das Gefühl, dass es etwas geben muss, was ich über Booleans nicht verstehe.
Ich empfehle einen Debugger oder Cout-Anweisungen, um die Werte der Variablen in Ihrem Code zu sehen. –