Question: Really have no idea why my code keeps failing on the 1 st part. * See picture * 1 :Calling the three unit test written

Really have no idea why my code keeps failing on the 1st part. *See picture*
1:Calling the three unit test written by you.
Calling bool test10; that was written by you to test your implementation of the myMadLib() function.
Compilation failed
Compilation failed
myMadLib.cpp: In function 'int testpassed(std::ofstreamd)':
myMadLib.cpp:43:18: error: 'test1' was not declared in this scope
43| bool result = test1();
myMadLib.cpp:54:13: error: 'test2' was not declared in this scope
54| result = test2();
myMadLib.cpp:65:13: error: 'test3' was not declared in this scope
65| result = test3();
*My code*
#include
#include
#include
// Function to check if a string is empty or contains only whitespace characters
bool isWhitespace(const std::string& str){
for (char c : str){
if (!isspace(c)){
return false;
}
}
return true;
}
// Function to generate a funny short story using provided inputs
std::string myMadLib(const std::string& firstName, const std::string& placeName, int number, const std::string& pluralNoun){
// Check if any of the input strings is empty or contains only whitespace
if (isWhitespace(firstName)|| isWhitespace(placeName)|| isWhitespace(pluralNoun)){
std::cerr "Error: Empty or whitespace-only input detected
";
return "";
}
// Construct the funny short story
std::ostringstream oss;
oss firstName " went to " placeName " to buy " number " different types of " pluralNoun ".";
return oss.str();
}
int main(){
// Read inputs from standard input (cin)
std::string firstName, placeName, pluralNoun;
int number;
std::cout "Enter first name: ";
std::getline(std::cin, firstName);
std::cout "Enter place name: ";
std::getline(std::cin, placeName);
std::cout "Enter a whole number: ";
std::cin >> number;
std::cout "Enter a plural noun: ";
std::cin.ignore(); // Ignore the newline character left in the input buffer
std::getline(std::cin, pluralNoun);
// Generate the funny short story
std::string story = myMadLib(firstName, placeName, number, pluralNoun);
// Print the story
if (!story.empty()){
std::cout "Funny short story:
" story std::endl;
}
return 0;
}
 Really have no idea why my code keeps failing on the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!