"Error: infinite loop"
Q: What's wrong with religion?
void religion(){
string target = "atheist";
string religious ="Do you believe in God?";
target = "Why would I?";
convince(target);
}
void convince(string target){
cout << "Because He's the savior!";
cout << "Only if you believe in him?;
cout << "So believe in him then!"
if (target == "Why would I?")
{ convince(target) } // Rekursivt anrop
}
A: It won't compile.
void religion(){
string target = "atheist";
string religious ="Do you believe in God?";
target = "Why would I?";
convince(target);
}
void convince(string target){
cout << "Because He's the savior!";
cout << "Only if you believe in him?;
cout << "So believe in him then!"
if (target == "Why would I?")
{ convince(target) } // Rekursivt anrop
}
A: It won't compile.
Kommentarer
Trackback