I am having trouble with cout. In my main function it kicks the ouput to the console like it should. However, when I call it from a function or method the output does not appear. Any ideas?
This is a console application on VC++ 4.0
int cubeByValue (int);
int cubeByReference(int *);
void printCharacters(const char *);
char myString = "print characters of a string";
int number = 5;
cout << "The original value of number is " << number;
/* number = cubeByReference(&number);*/
number = cubeByReference(&number);
cout << "\nThe new value of number is " << number << endl;
int cubeByValue (int n)
cout << "cubeByValue";
return n * n * n;
int cubeByReference (int * nPtr)
return *nPtr * *nPtr * *nPtr;
void printCharacters(const char * sPtr)
for (; *sPtr != '\0'; sPtr++)
cout << *sPtr;
cout << "hello world";
Guys, Thank You very much for the help. The article above helped. I needed to flush the output to get it to show. So I added "<< flush" to the end of my cout statements in the functions and it worked.
I also think the advice to upgrade is spot on and right.