I would have to write like 2 pages to answer all of these questions.
Gimmie a minute....
|What keywords explicit, virtual, protected, continue, volatile, friend and goto do?|
explicit, virtual, protected, and friend have to do with classes. It would be worthless to try to explain what they do if you don't first understand how classes work. So I won't get into this now.
A variable marked as
will be guaranteed to be physically written to memory every time you write to it, and will be guaranteed to be physically read from memory every time you read from it. Basically it prevents the compiler from "optimizing out" memory accesses (by keeping variable contents in a register, for example).
Typically you shouldn't use volatile, as it will just slow down your program. It's really only there for low level, direct hardware register access.
is used in loops to indicate that this loop iteration is done and it should continue with the next iteration. In a while or a do/while loop, this means that the condition will be checked again, and the loop will be restarted. In a for loop, the increment portion will be performed, then the condition will be checked, and the loop will restart.
// these two loops do the same thing
for(int i = 0; i < 5; ++i)
if( i == 3 )
continue; // continue the loop
DoSomething(); // this will not happen if 'continue' happened
for(int i = 0; i < 5; ++i)
if( i != 3 )
jumps to a label. It has a few practical applications but it mostly should be avoided. Until you know better... use this as a general rule: "Do not use goto".
|Can program have two console windows,|
Yes but that wouldn't really make a lot of sense. If you want multiple windows, you probably should not be making console programs.
| or can I make a program that runs two programs in the same time?|
Can program execute more stuff at once?
Yes, but that's probably not what you want to do. Multithreading would do this, but again that's probably not what you want.
You can make an extremely complex program that does all sorts of things in just one thread.
Most of the time you don't need to do multiple things "at the same time" because computers are so lightning fast that they can do multiple things sequentially and it will seem instantaneous to the user.
What is tripping you up is that you are probably doing something that stalls your program (like using cin for user input). Whenever you do that, your program effectively stops and waits for the user to input something.
Most [non-console] programs do not do this, but continue to do their work while polling for user input periodically.
|I know it is worthless, but is it possible to have two pointers pointing at each other?|
It is not worthless. And yes it is possible.
To dereference a pointer means to access whatever the pointer is pointing to.
int foo = 5;
int* bar = &foo; // bar points to foo
cout << *bar; // here, we are "dereferencing" bar, which means
// we are accessing whatever bar points to (in this case,
// that is foo)
This is not a programming term, but is a normal English word. The best way I can describe it is that a qualifier narrows or specifies the meaning of a word or phrase.
Example: "People are loud when they're in my house".
"When they're in my house" is a qualifying phrase because it narrows the effect of "People are loud".
If you want a better/more detailed description, look it up in a dictionary.
|what does operator -> do?|
It dereferences a pointer and accesses one of the members of whatever object is being pointed to.
foo* p = &o; // p points to o
p->a; // dereference p, and access it's 'a' member
(*p).a; // alternative way to do the exact same thing
|Is it stupid to write c++ compiler in c++?|