I haven't used C++ for that long and I have a few questions. I checked the FAQ which didn't have the answers i was looking for.
-When do I know when to put the int main() into my program? I was looking at the tutorial and it's usually right at the begginning right after "using namespace std;" but in the structure tutorial (basic) it's input later.
-Are the spaces neccessary after brackets and such?
-What exactly is an argument? It's been mentioned before but it never really went into detail (unless it did and I forgot) Sorry if this is a stupid question.
-I have no clue what the use of a pointer is...
-When i tried to write an extremely basic file that would show a certain text, only the first word came up. This is the code
the only word it shows is "This" If you spot an error, please tell me.Code:#include <fstream>
#include <iostream>
using namespace std;
int main()
{
char str[10];
ofstream a_file ( "example.txt" );
a_file<<"This text will now be inside example.txt";
a_file.close();
ifstream b_file ("example.txt" );
b_file>> str;
cout<< str <<"\n";
cin.get();
}
-What's the point of structures and classes? they dont seem to do much.
-How can i make a loop that will make something happen at least twice? When i try and make a do...while loop it either only does it once or it keeps doing it into infinity. how would i make it repeat only 5 time?
I know that these are all extremely basic things that i should probably know, but from the tutorials i just couldn't figure out what the heck some of this stuff does.
Any help would be appreciated.