i have a problem on C++ .. using Macro Functions ..
this is my code:
#include <iostream>
using namespace std;
#define test(x) ((x>4) ? (x + 3):(2*x-1))
int main()
{
double z;
int i;
for (i=1;i<3;i=i+1)
{
z = 2* test(i+2) + 4* test(1);
cout << "i="<< i
<<"\t Result:" << z
<< endl;
}
return 0;
}and here's what the console application says:
aaa..JPG 10.83K
18 downloadsshould the result be 14 and 18 .. what am i doing wrong .. :s ..??


Sign In
Create Account



Back to top









