whats wrong with this c++ code?
Not sure what you mean by "calling a pointer". Assuming you have "included" the proper files, you should check your use of qoutation marks.----ie-
int WinMain()
{
int x = 500;
cout << "Something something" << x << "something else " << endl;
If you missed this accidently, sorry. I do it a lot on this board. You don't need a pointer for this simple 'cout' exercise though.
------------------
Still Learning...
Still Learning...
OH, now I see what you meant. Not sure what the "&x" is for. Your "cout" will show the value of "X" with the simple cout << x <<;
You have no reference for &X.
You have no reference for &X.
Still Learning...
If you've created an win32 consol app, you shouldn't get any problems. It worked for me.
December 29, 1999 02:52 PM
In the tutorial I read it said that if you put an ampersand in front of a variable name it will represent the memory addresss of the variable not the contents and I was trying to print the contents of the variable followed by its memory address. i am doing this in a simple win32 console app and it wont work. What is wrong?
thanx in advance and HAPPY NEW YEAR
CoOlGuY
thanx in advance and HAPPY NEW YEAR
CoOlGuY
December 29, 1999 03:14 PM
Sorry actually what you have should work...ALl you need is to make sure you include and make sure your using a win32 console app. It works fine for me
Why don't you tell us what error the compiler is giving??
Regards
Starfall
December 30, 1999 06:46 PM
In VC++6 their is a small window at the bottom of the screen when you perform builds that indicates the progress. Whenever I try to build the app it attempts to compile the program and when its done it says errors: 1
warnings: 0
warnings: 0
December 30, 1999 06:53 PM
I am trying to build this sample program and vc++6 keeps telling me that their is one error and I can't find it. The program is supposed to return the value of the variable x and its memory address. Here is the code:
/* -example-[memory address of x']------ */
#include int main() cout << "The value of 'x' is " << x << ", its memory address is " return 0;
{
int x = 654;
<< &x << endl;
}
/*---------------------------------------*/
December 30, 1999 06:53 PM
Don't worry guys I got it to work. But thanx alot for all the help, couldn't have done it without ya 
All The Best

All The Best
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement