Hello guys, I started on C++ last night, here is what I wrote and put all my notes so I remember and know what each line is for.
Let me know if my notes are accurate, or if there are any mistakes or if anything I should just know! Thank you!
//Test one using C++ by Chef
//Lines beginning w/ # are directives for the preprocessor.
#include <iostream>
// Tells the preprocessor to include iostream standard file.
// iostream includes declarations of basic input-output library
using namespace std;
//namespace std(standard) is the entity in which we are writing code.
int main ()
// beginning of the main function, start of execution, all C++
// programs must have a main function, makes this function #1
{
//cout functions requires iostream. This is a statement line.
cout<<"Hello World!";
//semicolon is the end of a statement in C++.
//Most common syntax error is not using semicolon.
return 0;
//return statement causes main function to finish.
}
//cout is the standard output stream in C++.
//cout is always declared in the iostream standard file within the
//std namespace.
//The code above has the same functions as the one below, just written differently.
#include <iostream> using namespace std; int main () {cout<<"Hello People!"; cout <<"Testing 1 2 3!"; return 0;}