Click to See Complete Forum and Search --> : 2 Question where can i find graphic file , is there a online dictionary for C++
waheedrafiq
March 2nd, 2003, 04:17 AM
I am kind of stuck dude's , i recently started my first c++ course and i could tell you this much my teacher is next to nothing , and therefore i need some sort of help ,
i need to example to the exam person what the following mean
#define
int main()
return ( i think this means it returns a value )
void main() ( this one means no value is being pass throught)
cout<< ( this mean a string is being out putted )
cin>> ( receive a input from a keyboard )
; semi colon ( this tell the preprocessor which line to compliler )
// ( this is comment )
so you see if there was a online reference book free i can just check the meaning of the above and hopefull pass with some hands one practise .
my second question is i want to include in some of my basic program some basic graphic is this possible in C++ if so how
jfaust
March 2nd, 2003, 10:42 AM
You need a book. There are online references, and a simple search should find them.
#define is a precompiler directive, as is anything beginning with '#'. Before actual compiling, there is a step that processes all of these. For #define, it defines a symbol or replaces a symbol everwhere below in your file.
'int main()' is the main entry point for your program. When the program executes, this is where it starts as far as you are concerned.
'return' returns a value to the caller, or in the case of main(), returns the value back to the OS or shell.
cin and cout are indeed used for input and output. There's a lot of detail as to what these things actually are, but that's not really important at the start.
';' separates statements, either lines of execution or different parts of the 'for' statement.
'//' is a comment.
Graphics rely on what OS you are using, and often involve some larger framework. This question is too broad, and if you're still struggling with main() and return, probably too advanced at the moment.
Jeff
waheedrafiq
March 3rd, 2003, 11:57 AM
Thanks for your reply
Graham
March 3rd, 2003, 01:15 PM
By the way: "void main()" is a syntax error. Don't let anyone tell you any differently.
waheedrafiq
March 3rd, 2003, 02:33 PM
haaaaaaaaaa my tutor told me that when you have void main() it basically means no value is being pass
there was no mention about synax error
jfaust
March 3rd, 2003, 02:39 PM
Well, it's a syntax error according to the C++ standard, not necessarily a sytax error with a given compiler.
Whatever you want to call it, 'void main()' is wrong.
Jeff
Graham
March 3rd, 2003, 02:44 PM
If it's not a syntax error with a given compiler, then the compiler is in error. "void main()" is wrong, wrong, wrong. It is non-standard. It is an ex-statement. It has gone to join the code invisible. If it wasn't for Microsoft *, it would be pushing up daisies.
haaaaaaaaaa my tutor told me that when you have void main() it basically means no value is being pass
there was no mention about synax error
Get a new tutor, the one you've got is broken.
* and a couple of others, I know.
jfaust
March 3rd, 2003, 02:47 PM
If it's not a syntax error with a given compiler, then the compiler is in error.
Yup.
Jeff
waheedrafiq
March 3rd, 2003, 05:19 PM
guy's what is the big fuss about I mean can you explain to me what is the big different in void main() and int main() as far as my little knowledge goes , one you can't pass a value ("void main() ") and the other you can pass a value "int main()"
:confused:
jfaust
March 3rd, 2003, 05:23 PM
It's simply not standard C++. 'void main()' is illegal. The only confusion is that certain compilers incorrectly accept it as a valid statement. It should not compile.
Jeff
PaulWendt
March 3rd, 2003, 08:39 PM
Originally posted by waheedrafiq
guy's what is the big fuss about I mean can you explain to me what is the big different in void main() and int main() as far as my little knowledge goes , one you can't pass a value ("void main() ") and the other you can pass a value "int main()"
:confused:
See, here's what happened. A few compiler vendors [Microsoft
included] messed up their compilers. They treated main() like any
other function in some respects where it needed special process-
ing. In this instance, main() needs to have an int return type, not
void.
So, people get all fired up because it rubs them the wrong way
that Microsoft has the audacity to not only do something like this,
but also get away with it.... Just take the lesson, say thank you,
always have main() return int from now on, and it won't come up
again :)
You won't really notice any difference. It's technically not correct,
but the argument is mostly for semantics....
--Paul
waheedrafiq
March 4th, 2003, 10:59 AM
discussion is now settle thanks forks for all your support
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.