Pi Monkeh Dot Net
main
Pi Monkeh!
c++
page 1    page 2     page 3    page 4    page 5    page 6    page 7    page 8

right, so now you might have some kind of idea. just kidding, you're clueless. you don't know anything. now you'll learn two things. don't get too excited, or i'll beat you.

code:
#include <iostream>

int input;

int main()
{
    std::cout << "enter a number: ";
    std::cin >> input;
    std::cout << "you entered " << input;
    return 0;
}


oh my fucking god. what the fuck did i just do? this is a lot of new shit, so you better pay attention.
where's using?! i'll tell you this once, men belong in the mountains. we don't use shit. but we'll get back to that.

int input;
what? where are the parenthases and brackets? this is a variable, dipshit. by putting int in front of an arbitrary word, we've just reserved a few bytes in the computer (4, to be exact) to use for this variable that happens to be an integer. are there any more types? of course, we'll talk later.

std::cout
remember std? i should hope you do, it was only a page ago. instead of including the whole standard namespace (which, i'd like to remind you, is a heresy), we prefix each std member with std::. the two colons mean the object in question comes from std, but you don't need to know that yet. forget i told you.
if you don't like prefixing all your couts and cins with std::, there is another option that won't make you look like a total pussy. remember using namespace std;? replace that with using std::member;, for each member you need. this way you can use whatever you want without putting std:: in front of every single instance, and you won't go to hell for it.

cin
sin? no, console input. see the arrows? they're pointing the other way now. cin's arrows (along with cout) always point in the same direction. this means the data from console input is going into the variable that i cleverly named input. assuming the end user isn't an asshole by putting in a letter or something, that 4 byte variable will now hold whatever was entered.

std::cout << "text" << variable;
i simplified the statement from what you first saw, to show how it works. don't shit yourself, it won't be too hard. again, all the data is going into cout, so the arrows point towards it every time. this time, there's more than one thing to stash inside it, so there's two sets of arrows. first one is for "text", or "you entered " as you may remember it. if it's in quotes, that's what will print. the next one is the input variable, which was just set by console input. by not including quotes, we're telling the compiler not to print that word, but to print the value of whatever variable it is.

page 1    page 2     page 3    page 4    page 5    page 6    page 7    page 8