| | |
C++ Macros - help please
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I need help solving two macro questions in C++.
They are:
Define a macro PANIC that expands to code that uses coutÂ* to print the word PANIC and then calls a function quit (with no argumentsÂ*).
I think the answer is
#define PANIC;
cout <<quit();
but the compiler gives me errors.
My second question is:
Define a macro PLUS1 that accepts a valueÂ* as a parameterÂ* and produces an expressionÂ* representing 1 more than the valueÂ*.
My wrong answer was
#define PLUS1 (x)
PLUS1+1
If you know the answer, please tell me - also explain how you got the answer.
Thanks!
C++
They are:
Define a macro PANIC that expands to code that uses coutÂ* to print the word PANIC and then calls a function quit (with no argumentsÂ*).
I think the answer is
#define PANIC;
cout <<quit();
but the compiler gives me errors.
My second question is:
Define a macro PLUS1 that accepts a valueÂ* as a parameterÂ* and produces an expressionÂ* representing 1 more than the valueÂ*.
My wrong answer was
#define PLUS1 (x)
PLUS1+1
If you know the answer, please tell me - also explain how you got the answer.
Thanks!
C++
•
•
Join Date: Aug 2004
Posts: 4
Reputation:
Solved Threads: 0
ur first question is somewhat confusing. but i give my idea.
#define PANIC (cout<<"panic";quit()
)
the second question answer is:
#define PLUS1(x) (x+1)
still if u have any queries. write me to bvvkrishna@rediffmail.com
#define PANIC (cout<<"panic";quit()
)the second question answer is:
#define PLUS1(x) (x+1)
still if u have any queries. write me to bvvkrishna@rediffmail.com
•
•
Join Date: Aug 2004
Posts: 6
Reputation:
Solved Threads: 0
Hi,
the first questions answer is
#define PANIC cout<<"panic \n"<<quit()
you should not put ; (semicolan after a #define )
Now this will solve ur problem
For the second one the previous (Krishnas) answars has to work properly
it
#define PLUS1(x) (x+1)
if any more problem feel free to mail me to brnprasad630@yahoo.co.in
with regards
prasad
the first questions answer is
#define PANIC cout<<"panic \n"<<quit()
you should not put ; (semicolan after a #define )
Now this will solve ur problem
For the second one the previous (Krishnas) answars has to work properly
it
#define PLUS1(x) (x+1)
if any more problem feel free to mail me to brnprasad630@yahoo.co.in
with regards
prasad
When I run the first problem through the compiler, I get the message:
Wrong code assignedÂ* to PANIC. Check the function calls and don't forget semicolons.
On the second question, I get the error message:
It seems that you are lacking parentheses around the parameterÂ* supplied.
When I put a space between PLUS1 and (x), this message appears:
Wrong code assignedÂ* to PLUS1. Please revise.
Please help.
Thanks,
C++
Wrong code assignedÂ* to PANIC. Check the function calls and don't forget semicolons.
On the second question, I get the error message:
It seems that you are lacking parentheses around the parameterÂ* supplied.
When I put a space between PLUS1 and (x), this message appears:
Wrong code assignedÂ* to PLUS1. Please revise.
Please help.
Thanks,
C++
![]() |
Similar Threads
- mac macros in personal workbooks (Mac Software)
- Error Message in Word: Visual Basic Box 'Macros in this project are Disabled' (Windows NT / 2000 / XP)
- Macros & VB to create various letters (Visual Basic 4 / 5 / 6)
- macros in Excel for iMAC (Mac Software)
- Accessing files that are not currently open and running VB macros in them? (Visual Basic 4 / 5 / 6)
- Macros in Excel (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: Why can't I use Pointers to point to a Enumurated Constant
- Next Thread: C++ Division Remainder Help
Views: 9904 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines linker list loop looping loops map math matrix memory newbie news number output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





