I've written below simple code.Actually need to do that the value which is given by an user that will use as macro and macro value will automatically initialyzed to all needed place.Not to given every time.
#include<iostream>
#include "conio.h"
#define AB def()
int main(int argc, char* argv)
{
int a=3,b=2;
int def();
int add(int,int);
int sub();
std::cout << "\nAddition Result :" << add(a,b);
std::cout << "\nSubtraction Result :" << sub();
_getch();
//std::cin.get();
//system("pause");
return 0;
}
int def()
{
int m;
std::cout << "\nEnter The Value Of Def :";
std::cin >> m;
return m;
}
int add(int x,int y)
{
return (AB+x+y);
}
int sub()
{int v;
std::cout << "\nEnter The Value Of v :";
std::cin >> v;
int n=(AB-v);
return (n);
}
So,please any C/C++ expert please help me out from this problem.Thanks a lot