Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The two header files a.h and b.h both have a prototype for a single function. Both have at least two mistakes. Fix the mistakes so
The two header files a.h and b.h both have a prototype for a single function. Both have at least two mistakes. Fix the mistakes so that the tester program works correctly. Complete the following files: a.h 1 #ifndef A_H 2 #define A_H 3 #include 4 5 /** 6 Converts a character into the corresponding string form. 7 For example, calling charToString('Q') returns the string "Q". 8 @param c the character to convert. 9 @return the string form of the character. 10 */ 11 std::string charToString(char c)|| 12 { 13 return std::string(1,c); 14 } 15 #endif b.h 1 #ifndef B_H 2 #define B_H 3 #include 4 /** 5 Returns a string version of the bool argument. 6 @param b the Boolean value to convert 7 @return "true" or "false" 8 */ std::string boolToString(bool b) 10 { 11 if(b) 12 return "true"; 13 return "false"; 14 } 15 16 #endif 9 header guards written for a. h Expected: header guards written for a. h Header file ah has NO using namespace directive, Expected: Header file a. h has NO using namespace directive. string library type in a. h IS fully qualified. Expected: string library type in a. h Is fully qualified. header guards written for b.h Expected: header guards written for b.h Header file b.h has NO using namespace directive. Expected: Header file b.h has NO using namespace directive. string library type in b.h IS fully qualified. Expected: string library type in b.h Is fully qualified, Running Tester2.cpp Error: /tmp/codecheck. ab4t8D04sb/Tester2.cpp: In function 'int main()': /tmp/codecheck. ab4t8D04sb/Tester2.cpp:8:56: error: 'boolToString' was not declared in this scope cout using namespace std; #include "ah" int main() { cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started