Hey, I am trying to cover the basics of C++.
I think I have some of them down, I just need to double check if I'm right.
Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "Here is some text";
cout << endl;
cout << "What is 15 + 17? the answer is:";
cout << 15 + 17;
cin.get();
return 0;
}
Above is the first code I have written for C++, I found a little beginners tutorial for it. It is important to understand the code, so here it goes.
Code:
#include "stdafx.h"
#include <iostream>
They tell the compiler to include these in the .exe
They are both separate files containing code.
stdafx.h is a header code and isostream contains different packages that do several things.
Code:
using namespace std;
Tells the computer that it wants to use the package 'std' from ;isostream
Is the main function which every piece of code should have.
Opens the code.
Code:
cout << "Here is some text";
'cout <<' gives the program a output, or something to print. In this case its a line of text.
Cout is a keyword taken from the package 'std' which is in 'iostream;
'endl' ends the line
This tells the computer to print the answer of this calculation.
This makes the program wait for an input by the user
Once it has the input, it tells the computer to revert back to what it was doing before hand
closes code
I was wondering if you could check if I have it all right.
If there's anything I am missing as a beginner.. I would appreciate it if you point it out 
thanks
Bookmarks