next point

well hey everyone im new here , i was reading Bjarne Stroustrup - The C++ Programming Language(Third Edition) but was stucked at the very first chapters with the array of stack/pop/push and it really forced me to stop reading the book plus there isn't many examples to let u play in them and figure out what they means , well i have done the C++ Language Tutorial and i want to get expert in c++ and this tut isnt really enough :) so i want some advanced tuts that is suitable to me after this tut , well lemme ask , is it good idea to go back to bjarne stroustrup book and skip stuff i cant understand ? or what should i do ?
P.S i dont mind to be advanced in any section(applications) of c++ but my main point is to work on d3d hacks and get to know so much in libs
P.S i was tracing this code with step by step
1
2
3
4
5
6
7
8
9
10
void printmessage ()
{
  cout << "I'm a function!";
}

int main ()
{
  printmessage ();
  return 0;
}

but the problem is it kept like 3 min searching in libs and i couldnt understand the libs :D so what should i do ?
Sadly I was unable to understand parts of your request, but I can help, a little, in tracing this example.

So to start, as I'm sure you know the execution of any given program starts in the main() functions, because it is of the int type you need to return some int value. In our case 0 is used, to signal to the OS[ which is executing this function] that the operation was successful.

Now inside main we have a function call to 'printmessage', a function with no parameters. Normally the compile will need one of two things to allow this to occur.

Either A) The function is pre-defines, as in defined before the main, as is our case. Or B) given a 'prototype' of the function to include the function type and it's parameters.

To our example you have predefined the printmessage function a a void type, returns nothing, and it has no parameters.

Within this function you call the 'cout' command[ not certain of the exact name of this thing... sorry] but this comes from the iostream library[ basically a large group of command/functions not entirely clear on that either sorry again.]

But you pass the message "I'm a Function!" to the cout through the '<<' which allows cout to display said message on the console, that black box with white text which appears when you run this compiled program.

Does that explain the basic trace well enough for you?

-I apologize as I am still somewhat a beginner but thought I knew enough to get you started on perhaps more specific questions.
-Ty

void printmessage ()
{
cout << "I'm a function!";
}

int main ()
{
printmessage ();
system("PAUSE");
return 0;
}

i believe its read able now, always remember system("PAUSE"); when using DOS window applications idk if this helped answer your question thow
Last edited on
i believe its read able now, always remember system("PAUSE"); when using DOS window applications idk if this helped answer your question thow

http://www.cplusplus.com/forum/articles/11153/
Topic archived. No new replies allowed.