So what have i done in my first hour? Well, maybe it's been a bit of a slow start. I've downloaded the compiler and had a look at a few basic functions and keywords. For example
cont<<"I know it's not very advanced but still";
Well I'm going to go to bed now and do some more tomorrow, lets hope it starts to click then
The structure of a C++ program ( a simple one ) is that of some #include files, an "entry-point", usually the "int main()" function in console apps, "using namespace std", and various other functions if you need/want them.
ReplyDeleteOh it's "C-out" not "cont"
there is also a "C-in".
example:
[code]
#include //cout
using namespace std;
int main() //<-- entry-point
{
cout << "Ehlo, world!";
//return 0; // return 0 is added
// automatically in the main function.
}
[/code]
Without "using namespace std;" you will need to prefix the standard (std) library functions/classes with std::, which is the namespace name "std" and the scope resolution operator "::".
std::cout << "Ehlo, world!" << std::endl;
Well it butchered some of my code, probably because it thought it was HTML.
ReplyDeleteEnjoy learning a programming language. I learned Java recently and I found it super interesting.
ReplyDelete