#include <iostream>
//iostream has all your basic input and outputs
#include <iomanip>
//ionmanip has all your input and output manipulators
////It's basically for formating
#include <cmath>
//cmath is for all your math functions (basic, up to and slightly past high school)
#include <cstdlib>
//cstdlib is standard library, only thing you need in here is random generator (pseudo)
#include <ctime>
//ctime has time stuff, you only really need it for seeding random generator
#include <string>
//string includes the string object, part of STL (standard template library)
#include <vector>
//vector includes a vector, dynamic array, more like a linked list
//you can use this like a stack or queue if you use the right functions

//NOTE: the < > in the #include means to look in the environment defined path for
//              libraries, like the standard library places... " " means to look in my current directory

#include "example.h"

using namespace std;
// it says that you will be using things in the standard namespace.
// namespaces are collection of functions, object, constants... just stuff.
// with this line you are saved from typing std::cout or such, cout is sufficient.

//***NOTE: it goes to show that I will not have a tutorial on functions
//                      since all tutorials are in the form of a function.  But here's something
//                      on it anyway:
// **Regular Functions**
// format of function prototype (must come before calling function):
//              <return type> <function name>(<parameter type> <parameter name>...);
// i.e. double myFunc(int something);
//      Definitions:
//              for the function definition, I have put it down below the main.  COPY AND PASTE the
//              prototype down before starting to code.  If you are not 100% perfect it will have a
//              link error.  Look below int main() for the definitions of my tutorials.
// **Pass by reference**
//  Def: pass by reference doesn't make a copy of the variable like the previous case does.
//              It references back to the calling function so that if you change the value in the
//              function, it gets reflected back in the calling program.
//      Syntax:
//              <return type> <function name>(<parameter type> & <parameter name>...);
//      i.e. double myFunc(int & something);
//      Explanation:
//              Why do we wnat to use it?  You can pass back multiple things instead of just one.
//              You also can save memory (bad reason in today's world).

//function demonstrates basic I/O
void inputOutput ();
void conditionals();
//loops of various sorts
void loops();
//basic string manipulations (I expect you to know what to do with it)
void stringManipulations();

int main()
        // your main program is just another process in the operating system
        // it returns a value of int (in our case we return 0 if it executes properly).
        // It's like 0 for successful and anything else is a variety of errors.  Read
        // documentation for more.  If you want the main program to take command line
        // parameters you simply add parameters (google for argc and argv for details).

        example myExample;
        // once you have defined the object example, it becomes a data type... you use it
        // like any other type like int, double, string, etc.
        return 0;

//function demonstrates basic I/O
void inputOutput ()
        int someNumber;
        cout << "Hi Sean" << endl; //cout is your basic output, stands for consol out
                                                                //endl is return carriage, start new line, or how you call it
                                                                // "\n" does the same thing as endl
                                                                // a \ in double quotes signifies escape, special commands
                                                                // google for more like \t, \b
        cin >> someNumber; // cin is the basic input, consol input
        // the problem with cin is that once it hits a white space (space, tab, new line, etc),
        // it just stops reading.  It's also particularly dumb with the type.

        string someInput;
        getline(cin, someInput); // however getline doesn't stop at white spaces, it reads
        // the whole darn line.  Sometimes you will need to do cin.ignore() around it to get
        // it to work for some installations of visual studio.
void conditionals()
        bool a = true;  // make sure you don't capitalize the T and F and spell it out
                                        // 0 is false, everything else is true, doesn't have to be just 1 to be true
        bool b = false, c = true, d = false;

        if (a == b)
                cout << "a equals b" << endl;
        else if (c != d)
                cout << "c is not equal to d" << endl;
                cout << "a doesn't equal b and c is equal to d" << endl;
                cout << "there are also multiple lines here... so you need the { and } for the else"
                        << endl << "cout statements can span multiple lines as long as ; is not there" << endl;

        // other notations: && = and,
        //                                      || (shift value for backslash, otherwise known as pipe in unix) = or
        //                                      ! = not
        // you can NOT use keywords like "and", "or", or "not" unless you use #include <ciso646> but do it the real way anyway, it's easier.

        // special note: demorgan's theorem.
        // notation: + = or logic, * or multiplication = and logic, n' means not n
        // demorgan's:  1) (ab)' = a' + b'
        //                              2) (a + b)' = a'b'
//loops of various sorts
void loops()
        //NOTE: all loops in this program does the same thing except the do-while loop
        int count = 0, n = 10;
        while (count < n)
                cout << count << endl;
                count++; // -- means decrement, ++ means increment, make sure it's on a line of its own!  order matters, so don't trick yourself

        count = 0;
        // the difference between while and do-while is that do-while
        // will guarantee to run at least once.
        do {
                cout << count << endl;
        }while (count < n);

        // this is the famous for loop, all programmers use for loops 80% of times...
        for (count = 0; count < n; count++)
                cout << count << endl;
        // NOTE: you don't need the { and } if anything is only one line, more than
        //              one line needs { and }.
//basic string manipulations (I expect you to know what to do with it)
void stringManipulations()
        string someString = "hi there"; // strings are used like a c-string
        int firstBlank = someString.find(" "); // this finds the first blank in "hi there"
        string firstWord = someString.substr(0, firstBlank);
        // this is not perfect but substr will give you a substring of the original.  First
        // parameter is the starting location of the substring and second is the length...
        // NOT the ending position.
        string secondWord = someString.substr(firstBlank + 1, someString.size()-firstBlank-1);
        // once again, not perfect but if starting location + length > length of string, then
        // it will just cut you off at the end of string, no errors or exceptions.

        string original = firstWord + secondWord;
        // the + operator is overloaded to be concatenation for strings.