Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   C++,Macro Problem (http://www.go4expert.com/forums/cppmacro-problem-t18138/)

 sdmahapatra 21Jun2009 13:59

C++,Macro Problem

Quote:
 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.
Code:

``` #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); } ```
Quote:

 sdmahapatra 21Jun2009 17:15

Re: C++,Macro Problem

I am coding a big program and this macro concept is needed to use there.This program is only to clear my doubt.I want once I've giving the value of def which keep stored in m.Second time the value of m automatically taken by
Code:

`int sub()`
function.Once I given the value of def,I don't want to give it again through the program.

 sdmahapatra 17Jul2009 00:11

Re: C++,Macro Problem

this has been solved

 All times are GMT +5.5. The time now is 03:21.