A function-like preprocessor macro. Modify the header file below to add a MAX macro that evaluates to the largest of its two arguments.
#ifndef MACRO_H#define MACRO_H
......
Tester.cpp
#include #include #include using namespace std;#include "macro.h"int main() {string a{"frog"}, b{"dog"};cout < max(1,="" 2)=""><>cout < "expected:="" 2"=""><>cout < max(a,="" b)=""><>cout < "expected:="" frog"=""><>cout < max(2.5,="" 1.5)=""><>cout < "expected:="" 2.5"=""><>cout < max(acos(-1.0),="" sin(7))=""><>cout < "expected:="" 3.14159"="">< endl;="">
#include #include using namespace std;#include "macro.h"int main() {string a{"frog"}, b{"dog"};cout < max(1,="" 2)=""><>cout < "expected:="" 2"=""><>cout < max(a,="" b)=""><>cout < "expected:="" frog"=""><>cout < max(2.5,="" 1.5)=""><>cout < "expected:="" 2.5"=""><>cout < max(acos(-1.0),="" sin(7))=""><>cout < "expected:="" 3.14159"="">< endl;="">
#include using namespace std;#include "macro.h"int main() {string a{"frog"}, b{"dog"};cout < max(1,="" 2)=""><>cout < "expected:="" 2"=""><>cout < max(a,="" b)=""><>cout < "expected:="" frog"=""><>cout < max(2.5,="" 1.5)=""><>cout < "expected:="" 2.5"=""><>cout < max(acos(-1.0),="" sin(7))=""><>cout < "expected:="" 3.14159"="">< endl;="">
#include "macro.h"
int main() {
string a{"frog"}, b{"dog"};
cout < max(1,="" 2)=""><>
cout < "expected:="" 2"=""><>
cout < max(a,="" b)=""><>
cout < "expected:="" frog"=""><>
cout < max(2.5,="" 1.5)=""><>
cout < "expected:="" 2.5"=""><>
cout < max(acos(-1.0),="" sin(7))=""><>
cout < "expected:="" 3.14159"="">< endl;="">
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here