Thursday, December 8, 2016

Getting good at: C | #2 - getchar and putchar

2 - putchar('='); putchar(')');

How's it going bros. The next jacksepticeye here. Today, I'm going to show you how to use getchar() and putchar(). These are self explanitory: getchar receives a character, and putchar prints out a character. 

So to use putchar, type putchar(':'); in your main function. You can replace ':' with any character you want, so long as you keep it inside the single quotes. Your program should look like this:

int main()
{
    putchar(':');
    return 0;
}

This should print a colon on the screen.

In order to use getchar, we have to be familiar with another type of variable: char. (Actually, you can get away with using regular variables, but I don't recommend it.) Char is a variable that can only be used for characters. (You can set char variables to equal numeric values, but it'll be translated to ASCII, which will make it a character.) To use it, type char name = ':';, where 'name' is any name you want, and ':' is the character the 'name' is set to. Like regular variables, we can set char name to nothing, but to use getchar, you have to set char name equal to getchar(). Your program should look something like this:

int main()
{
    char name = getchar();
    return 0;
}

This allows the user to input any character. To output this character, just add printf("%c",name);, where "%c" tells printf() that the integer we're passing through is a character. Your program should look something like this:

int main()
{
    char name = getchar();
    printf("%c",memes);
    return 0;
}

This allows the user to input a character and outputs the same character. You can also use getchar() to pause a program. For example:


int main()
{
    int memes;
    memes = 1337;
    printf("memes = %d\nPress any key to continue.\n",memes);
    getchar();
    return 0;

}

This prompts the user to enter a character, and only after that will the program stop.

NOTE: You don't have to do the challenges below, but you can if you want to.

With this newfound knowledge, write a program that properly utilize both getchar() and putchar().

That's all I have for now. Until then...

Friday, December 2, 2016

Getting good at: C | #1 - Integers and printf()

1 - int a = 9

No, that's not a typo. C is a programming language published in 1978 by a company called 'Bell Labs'. (later AT&T)

C and C++ are very similar in syntax (They both look similar), but there are a few differences, a big one being that you can't make a class the same way you could in C++. With that out of the way, let's get right into this.

NOTE: If you have not installed Code::Blocks prior to reading this tutorial, do so now. If you're having trouble installing it, refer to this post.

So before we get started, we need to first make a C project. (Most projects are C++ by default.) 

Step 1: Click on 'Create a new project'.

Step 2: Click on 'Console Application'.

Step 3: Click 'Next >' once.

Step 4: Choose 'C' from the list.

Step 5: Continue as normal.

So after you're done, you should see something like this:

#include <stdio.h>
#include <stdlib.h>

int main()
{
     printf("Hello World\n");
     return 0;
}

This is a program that prints 'Hello World' on the screen. This is how it works:

#include - This tells the compiler to include a header file, usually stdio.h

int main() -  This is your main function. You can put statements like 'printf()' in it. 

NOTE: Don't forget to include this function in your program, or else it won't compile.

printf("words") - This statement prints words, values, or other stuff on the screen.

return 0 - When a program runs successfully, it returns a value of '0' to the system, telling it that the program ran without errors.

NOTE: Don't forget to put semi-colons at the end of your statements. Otherwise, you'll 
T R I G G E R your compiler.

To make a variable in C, you type 'int ' (without the quotes) and then your variable name. Then set it equal to something. (The bold letters signify that it was typed recently. You don't have to copy and paste the entire function to write a new statement.) It should look like this:

#include <stdio.h>

int main()
{
     int a = 2;
     return 0;
}

After that's done, press 'enter' and type 'printf("")' (without the ' quotes). In the " quotes, type %d . Outside the " quotes but still in the parentheses, put a comma, and then your variable name, in this case it's a. It should look like this:

#include <stdio.h>

int main()
{
     int a = 2;
     printf("%d", a);
     return 0;
}

After you're done, you should see something like this:

2
Process returned 0 (0x0)
Press any key to continue.


homework

You don't have to do these, but you can if you want to. I highly recommend you do so, because they will make learning programming languages a lot easier.

Exercise 1-1: Write a program that prints 5 on the screen, but make a variable and pass it to printf() rather than doing something like 'printf("5");'.


That's all I've got for today.

Wednesday, November 23, 2016

Why I haven't been posting.

dead blog

So I haven't been posting at all this week and you may be wondering why.Well first of all, I'm lazy, and second, I'm starting to learn other programming languages such as C (Not C++), Java, and C# so I can make a series on those later on. On top of that, i started experimenting with an operating system called "ReactOS", and if you don't know what ReactOS is, check out this page. That's all I've got for now.

Tuesday, November 15, 2016

Getting good at: C++ | #8 - while and do-while loops

8 - inception

Hey guys. The next pewdiepie here. Today, I'm going to show you how to make 'while' and 'do-while' loops. So a while loop is a type of loop that occurs when a conditional is true. If we make a variable named 'conditi0nal', and set it equal to 100, then we can write something like:

while(conditi0nal<=200)
{
     cout << "memes" << endl;
     conditi0nal++;
}

So as long as 'conditi0nal' is less than or equal to 200, it will print out "memes" and increase the value of 'conditi0nal' by one until it reaches 200.

A do-while loop is similar to the while loop, except that it does that body of code regardless if the conditional is true or false. So something like this:

do{
     cout << "memes" << endl;
     conditi0nal++;
}while(conditi0nal<=200);

This version of the while loop isn't used very often, so you don't have to worry about it too much.

While loops can also be used for user-defined variables. For example:

int answer;
cout >> "Is Control Alt Defeat best YouTuber?\n1. Yes\n2. No\n";
cin >> input;

while (input!=1)
{
     cout << "wrong answer" << endl;
     cin >> input;
}

cout << "thats right" << endl;

So in this program, we created a variable, and made the user input a value of 1 or 2. If the variable is set to 1 (it better not be), it will keep going until you set it to 2, in which case it will end the program.

That's all for now. 

Tuesday, November 8, 2016

Something seems fishy about this...

rigged

I was growing weary of my daily Study Hall occupations (looking up sub $200 graphics cards on Amazon) and saw my friend taking an online IQ test. I didn't have anything better to do (I couldn't watch YouTube because the network sniffers are like hawks) so i decided to give it a shot...



and here are my results:

Originally it was 142, but I didn't have the screenshot, so I had to redo it. 

Notice the unrealistic IQ score. Keep in mind that the entire test is only 20 questions long. They aren't even hard. How do you get an IQ of 164 from answering 20 questions? 

My theory is that the people who wrote this webpage made a variable (iqscore) and set it equal to zero, and made the user input an answer. The answer input would be linked to a variable, and when they input their answer, it sets this variable to a value, and this value is linked to a switch(){case} statement (Or Javascript/HTML equivalent), and depending on whether or not the user is right, will do something like iqscore = iqscore + 24, and repeats this 20 times. Once you reach the end, it will print iqscore on the screen.

I can see where they were going with this, but at the same time, I can see how this would cause some problems. It's kind of like when nVidia made the Tegra X1 and noticed that it had less power than the average sub $300 PC, so instead of doing it right and calculating the performance in FP32, they covered up their mistake by calculating it in FP16 (those sly dogs). 

Now this is a theory, so don't go after the people who wrote this test. Just know that some online IQ tests can be inaccurate. 

TL;DR: don't believe everything you see.

Website: free-iqtest.net

Picture: "https://www.pcper.com/files/imagecache/article_max_width/news/2015-02-16/Burned_laptop_secumem_11.jpg"; Perspective, PC; 8 November, 1782.


Wednesday, October 26, 2016

Getting good at: C++ | #7 - Objects and Classes

#7 - ricky reed is best gem

How's it goin bros, Virgil Rhino here. Today, we're gonna discuss classes. Classes are similar to int main because they both use curly braces. The difference is that classes don't require a set of parameters, and int main doesn't require access specifiers (public:, protected:, and private:). Keep in mind, however, that classes are not functions, but they can contain functions. Say for instance, you create a class. For this example, we're going to call it 'kek'. Our class is going to have the public access specifier:

class kek
{
public:
     
}

And it's here that we're going to create our function. We're going to create a void function, because unlike an int function, void returns nothing, so we don't have to type 'return 0;' at the end.

class kek
{
public:
     void dAnK()
          {
               cout << "kek" << endl;
          }
}

Functions inside of a class are called class member functions.

Now, we're going to use this class member function by creating an object. An object contains all the functions and variables contained on our class, which is how we can use that class member function. To make an object, go to int main() and type 'kek kekObj;', where 'kek' is our class name, and 'kekObj' is our object name. Below that, type 'kekObj.dAnK();'. This tells our object to use the class member function, titled dAnK(), which outputs 'kek'. When you're done, your program should look like this:

class kek
{
public:
     void dAnK()
     {
          cout << "kek" << endl;
     }
}

int main()
{
     kek kekObj;
     kekObj.dAnK();
     return 0;
}

And your result should look like this:



This is how not to create a class. You don't make a class file without including private:, and you definitely don't use it to output text. That's a waste of a class file. I left this in here to help you avoid this.

To properly set up a class file, we first need to erase everything in our class and int main. It should look like this:

class kek
{
     
}

int main()
{
     return 0;
}

Now, we add our public and private access specifiers:

class kek
{
public:
     
private:
     
}

And inside the private: access specifier, we add a variable and set it equal to any value. For this example, I'm going to set it to 40:

class kek
{
     public:
     
     private:
     int dank = 40;
}

int main()
{
     return 0;
}

Now in our public: access specifier, we add what are called Accessors and Mutators. These are self-explanatory. Accessors and Mutators are both class member functions that deal with the integer (also called 'data members') in the private: access specifier. 
Mutators set the private: data member to something, and Accessors read from the private: data member. 

Mutators are typically void functions because they're supposed to set the private: data member to something and return nothing. Accessors are usually int functions because they're only supposed to return the private: data member. 

Something like this:

class kek
{
     public:
     void setDank(int x)
     {
          dank = x;
     }
     int getDank()
     {
          return dank;
     }
     private:
     int dank = 40;
}

int main()
{
     return 0;
}


And now we add our objects:

class kek
{
     public:
     void setDank(int x)
     {
          dank = x;
     }
     int getDank()
     {
          return dank;
     }
     private:
     int dank = 40;
}

int main()
{
     kek kekObj;
     cout << kekObj.getDank();
     return 0;
}

Note that you don't need to add cout <<, I'm just adding it as proof that our public: class member functions (Our 'getters and setters') did what they were supposed to. 

Your result should look like this:



That's all for this post. In the next tutorial, we'll be going over objects and classes. Until then....

Wednesday, September 28, 2016

Personal Post #4

no chin

So two days ago, I tried to host a Minecraft server. Tried. I got a domain name and linked my IP to it so people can connect to my server. On my side, I hosted the server on a port (25565) and forwarded it so it would redirect everyone to my local IP or in this case, my server. So it should work fine, right? Well, it redirected fine, but it said "Connection refused: no further information" which led me to believe my modem was blocking outside connections. I wasn't quite sure about that, because I looked and it didn't seem to be blocking anything, so I did a bit of research and found out that the Windows Firewall was the issue, so I disabled that and guess what? "Connection refused: no further information". So I decided to use my public IP instead. Still, "Connection refused: no further information." It wasn't until I used my local IP that it finally worked, leading me to believe that either a firewall is blocking outside connections, or I didn't configure the server properly. Either way, I won't release the domain name until I get the server running. Until then...

Friday, September 23, 2016

bad idea

delete your channel

The 8800 GTX was released in November 2006, and supports the DirectX 10 API. During its release, it was the single most powerful GPU NVidia has ever made at the time. Capable of outperforming the Radeon HD 2900 XT, the 7950 GX2, and TWO X1950s, the 8800 was no slouch. Now, more than 9 years after it's initial launch, it's still capable of running some AAA titles at reasonable framerates, which got me thinking: if it can run DX9/10 games well, could I daisy chain 3 of them together and Force WARP DX11 and get reasonable performance in other AAA titles? I would need a pretty hefty setup to support 3 8800 GTX cards, but I think it might just be possible. We'll see...

Thursday, September 22, 2016

Getting good at: C++ | #6 - If-Else Statements

6 - wake me up inside

How's it going everyone? No Chin here, and today we're going to talk about If-Else statements. Basically, an If-Else statement is a lot like a real world If Else statement. Something like: If something is true, then do something. Otherwise, don't do anything.

Unlike the other objects we used, the If statement uses its own set of curly-braces and parameters. Here's an example:

int main()
{
     int x;
     cin >> x;
     if(x==1)
     {
          cout << "WHy" << endl;
     }
     return 0;
}

The parameters have to be set to something with the If statement, so in this case, we told the If statement that x has to be equal to 1 in order for it to output something, and if x is not equal to 1, it can't output anything. However, we can still get it to output something even if x is not equal to 1, and that's where the Else statement comes in. Unlike the If statement, the Else statement doesn't require its own parameters. It's basically just a continuation of the If statement. For example:

int main()
{
     int x;
     cin >> x;
     if(x==1)
     {
          cout << "topkek" << endl;
     }
     else
     {
          cout << "get off my computer" << endl;
     }
     return 0;
}

Note that the "==" is intentional. One equal sign sets a variable, and two means that something is equal to another thing.

Now let's go back to our password program. Last time, we excluded the if-else statement, so the string could be set to anything and it would output the same result. Let's try it with the If-Else Statement:

int main()
{
     string harambe;
     cin >> harambe;
     if (harambe=="harambe")
     {
          cout << "f" << endl;
     }
     else
     {
          cout << "get off my computer" << endl;
     }
     return 0;
}

You should see something like this if you got the password right (Top is password, bottom is output):



And something like this if you got the password wrong:



Keep in mind, this is a very basic password program so it has no method of keeping your personal documents safe.

That's all I have for now. Until then...

Wednesday, September 21, 2016

Personal Post #3

Personal Post #3

So two days ago, I got some cool stuff. And you know I love cool stuff. I got not one, but TWO graphics cards. For free.

The cards themselves aren't special; in fact, you might find them quite depressing. The one on the bottom is an ATI Radeon X1550 AGP (256 MB), and the one on top is a Radeon HD 2400 PCI (Also 256 MB). Someone lent these to me (I won't be disclosing their name for privacy reasons.) to use for testing, but the PC I was going to use was not with me as of Monday, so I just looked at them, admiring the poorly-rendered image on the heatsink. Interestingly enough, I actually have an HD 2400, but it has twice the vRAM as the other one, and it uses the AGP bus. I find it cool that I could use these, because for one, I love old computer stuff, and two, I don't usually see these for free, so this was a big surprise. Aside from that, I did some photoshopping.



BTW, it took me like 10 minutes to make that. That's all I have for now. Until then...

Getting good at: C++ | #5 - Strings

Stuff you don't care about

This blog has breached 100 views already. If it got that many views in the time it existed, you better believe I'm gonna shamelessly promote my channel.

5 - Bad Password Program

So today, we're going to be writing a program that takes advantage of strings. In case you don't know what a string is, it's basically an object, and with all objects comes classes. This particular object comes from the class <string>. How you would implement this class is by typing #include <string>. In fact, that's how you implement most classes, but more on that later. For now, let's write a terrible password program. To start, create your string, and set it to what you want. For example:

{
     string harambe;



}

Then use cin >> to allow the user to input the string, so in this case, 'harambe':

{
     string harambe;
     cin >> harambe;


}

Then, let's output some text; in this case, "personal information":

{
     string harambe;
     cin >> harambe;
     cout << "sub to control alt defeat" << endl;
     return 0;
}

After you compile it, you should see something like this:

Note that the top (harambe) is our input, and the bottom (f) is our output. Keep in mind this is a terrible password program, because you can type whatever you want and you'll get the exact same result, as shown here:



In case you're wondering, I used \n to space the input and output so it would be easier to explain.

I'll show you how to change that in the next post. Until then...






Monday, September 19, 2016

Personal Post #2

Roight into the neeewwwwwssss

So I've been using Windows 10 for the past 12 and a half months now, and let me just tell you: It's the most unfinished operating system I've seen in a long time. Performance issues, 3-5 hr battery life, problems interacting with hardware, Cortana, etc. And get this: A license of Windows 10 (With NO office suite/application bundle) costs $50-70. If you don't think that's bad, a standard install of Ubuntu (With a full office suite, compatible with Word/Excel/PowerPoint) costs...you know what? I'll let you guess...


Go ahead, I can wait.


Did you guess it? $130-$150? Nope. It's free. Yep. Office suite and all. Furthermore, it comes with drivers compatible with AMD/NVidia/Intel graphics cards. With the correct version of OpenGL. I kid you not. Do you think Microsoft provides these drivers out of the box. Nope. If you think you can get away with not installing any graphics drivers on your PC, Microsoft isn't gonna have it. You're stuck with OpenGL 1.1. Shoutout to anyone who remembers that from 1997. Also, the .iso for Ubuntu is significantly smaller than the Windows .iso. But back to the drivers; I understand that the drivers on Linux are freeware, and incompatible with NT (Win 2000/XP/7/8/8.1/10), but it's something I personally can't stand. Anyway, if you want the .iso for Ubuntu, click here. To use it, burn it to a flash drive. Imaging software includes: Rufus, UNetbootin, Universal USB Installer, etc. If you prefer your installer on optical discs, you can use ImgBurn. If you want to retain your copy of Windows and run it, select "Run Ubuntu from this CD/USB", or Install Ubuntu alongside Windows Boot Manager (Assuming you're running Windows 10). If you use software compiled for Windows, press Ctrl+Alt+T, type

sudo dpkg --add-architecture i386

This will enable 32-bit architecture on a 64-bit system. Then, add the repository:

sudo add-apt-repository ppa:wine/wine-builds

Then update the packages:

sudo apt-get update

Then install:

sudo apt-get install --install-recommends winehq-devel

For the in-depth guide, click here. This method should work for Debian as well.

That's all I've got. Subscribe to Control Alt Defeat. Until then...

Friday, September 16, 2016

Getting good at: C++ | #4 - User-defined variables.

4 - Typing in stuff and outputting a result

ello blazers NFKRZ ere and today we're going to cover User-defined variables. So you guys know about cout << which outputs text or variables on the screen. What you guys don't know is that there's a way to INPUT text, with cin >>. Now, this doesn't mean you can just do this:

int main()
{
     cin >> "top kek m8";
     return 0;
}

Don't be lazy. If you're gonna input text, include a string. I'll cover that in the next post. For now, I'm gonna show you how to make a basic user-defined variable. So you want to make a variable:

{
     int a;
     cin >> a;
}

Now, we're going to use cin to input what the variable will equal:

{
     int a;
     cin >> a;
     return 0;
}

Now, let's output the variable:
{
     int a;
     cin >> a;
     cout << a;
     return 0;
}

And you should see something like this:

Note that the '69' on the top is our input, and our '69' at the bottom is our output, meaning we set the variable to '69', and we made it output '69' on the screen with cout. That's all for today. Until next time...



Wednesday, September 7, 2016

Personal Post #1

The Title

Yes, I know. It's the most unoriginal and boring title you've ever seen. No, I'm not gonna change it. At least not for a while. The title follows a general theme that's unrelated to the C++ series, and that's why it works. Okay? Cool, thanks.

The Post

Just got to address something, I haven't posted a third post about the programming series. I'm actually almost done, so I'll most likely post it after this post goes live. One of the reasons I haven't finished it yet is because, get this, I was literally drawing a bunch of Steven Universe fanart over the weekend. I kid you not. Aside from that, my power supply on my main PC died. Probably because either the motherboard drew too much power, or my PSU didn't supply enough power to the motherboard. Or my PSU just sucks. Speaking of my main PC, I really need to get a new GPU and PSU. I'm going to get the GTX 1060 and an EVGA 400/430w PSU (Non-Modular), but I bet none of you really care so...

Nothing too important is going on, really. When I get my main PC fixed up, I'll be uploading a LOT more content. So that's about it. until next time...


Tuesday, August 30, 2016

Getting good at: C++ | #3 - Writing our first program

Before we start...

This blog has like 65 views in a week. O_O



3 - Actually Writing The Program

Alright, so now that you know how a program works, let's write one.

Just make sense out of this:

#include <windows.h>
#include <gl/gl.h>

LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM);
void EnableOpenGL(HWND hwnd, HDC*, HGLRC*);
void DisableOpenGL(HWND, HDC, HGLRC);


int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
    WNDCLASSEX wcex;
    HWND hwnd;
    HDC hDC;
    HGLRC hRC;
    MSG msg;
    BOOL bQuit = FALSE;
    float theta = 0.0f;


    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style = CS_OWNDC;
    wcex.lpfnWndProc = WindowProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    wcex.lpszMenuName = NULL;
    wcex.lpszClassName = "GLSample";
    wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);;


    if (!RegisterClassEx(&wcex))
        return 0;

    hwnd = CreateWindowEx(0,
                          "GLSample",
                          "OpenGL Sample",
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          256,
                          256,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    ShowWindow(hwnd, nCmdShow);

    EnableOpenGL(hwnd, &hDC, &hRC);


    while (!bQuit)
    {

        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {

            if (msg.message == WM_QUIT)
            {
                bQuit = TRUE;
            }
            else
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
        else
        {
           

            glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            glClear(GL_COLOR_BUFFER_BIT);

            glPushMatrix();
            glRotatef(theta, 0.0f, 0.0f, 1.0f);

            glBegin(GL_TRIANGLES);

                glColor3f(1.0f, 0.0f, 0.0f);   glVertex2f(0.0f,   1.0f);
                glColor3f(0.0f, 1.0f, 0.0f);   glVertex2f(0.87f,  -0.5f);
                glColor3f(0.0f, 0.0f, 1.0f);   glVertex2f(-0.87f, -0.5f);

            glEnd();

            glPopMatrix();

            SwapBuffers(hDC);

            theta += 1.0f;
            Sleep (1);
        }
    }


    DisableOpenGL(hwnd, hDC, hRC);


    DestroyWindow(hwnd);

    return msg.wParam;
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_CLOSE:
            PostQuitMessage(0);
        break;

        case WM_DESTROY:
            return 0;

        case WM_KEYDOWN:
        {
            switch (wParam)
            {
                case VK_ESCAPE:
                    PostQuitMessage(0);
                break;
            }
        }
        break;

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }

    return 0;
}

void EnableOpenGL(HWND hwnd, HDC* hDC, HGLRC* hRC)
{
    PIXELFORMATDESCRIPTOR pfd;

    int iFormat;


    *hDC = GetDC(hwnd);


    ZeroMemory(&pfd, sizeof(pfd));

    pfd.nSize = sizeof(pfd);
    pfd.nVersion = 1;
    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
                  PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 24;
    pfd.cDepthBits = 16;
    pfd.iLayerType = PFD_MAIN_PLANE;

    iFormat = ChoosePixelFormat(*hDC, &pfd);

    SetPixelFormat(*hDC, iFormat, &pfd);


    *hRC = wglCreateContext(*hDC);

    wglMakeCurrent(*hDC, *hRC);
}

void DisableOpenGL (HWND hwnd, HDC hDC, HGLRC hRC)
{
    wglMakeCurrent(NULL, NULL);
    wglDeleteContext(hRC);
    ReleaseDC(hwnd, hDC);
}


Okay fine, we'll start with something easier.

So before you do anything, start with these 2 lines:

#include <iostream>
using namespace std;

If you don't know what these do, then look at the second blog post, because I'm not explaining it again.

Now, let's make our main variable:

int main()
{

}

Now I haven't told you guys this, but you can add more than one variable to a program. Today, we're going to start out by creating a variable within a variable. The difference between standalone variables (int main(), etc...) and nested variables (int memes) is that with nested variables, you don't need to add parameters and a function to it, whereas with standalone variables, you do. So, to create a nested variable, you need to go into your function, and type:

int a;
a = 69;

or

int a = 69;

This means you have created a variable, and set the value of it to 69 (hehe 69). To display this variable, type:

cout << a << endl;

In case you're wondering, endl; ends the line so text can appear below it.

And of course, finish it off with:

return 0;

After you're finished, your program should look something like this:




For the .01% of you who are wondering how I got the command console to output our variable, you have to go to the toolbar just below the top, and click on this icon.

And that's all there is to it. Next post, I'm going to be covering User-defined variables. Until next time...