Monday, July 11, 2011

1. The Silly Setup

 It’s easy to play with friends, only deciding which game to play takes time. But let’s not waste our playtime deciding which C++ IDE (Integrated Development Environment, a geeky name for the software which helps silly programmers in writing and developing silly software products), let’s just jump to any IDE…….. I will use Dev C++, its compact and free, I don’t wanna spend a single penny for you dumbos!

I hope, from the fact that you had the ability to open an internet browser and somehow reach till my blog, that you will be able to search and download Dev C++ (any damn version of it) and install it in your PC, without my elaborating its steps.

So let’s jump straight to the hell called programming.

In case, you haven’t opened the Dev C++ IDE yet, just double click on its icon in Start Menu; that will do the trick. Once it’s open, don’t start looking around agape, it’s just one little IDE among million more like it. Let’s get going with the programming.

Lazily move the mouse up and click on File, then on New and then finally on Source File. The hotkey for it is Ctrl+N, by hotkey they meaning shortcut key, there’s nothing hot about it, it’s as cold as a programmer’s face. Next time onwards use the hotkey.

So now you have a new, clean, blank page to write a program on! But before you can think of innovating and being creative and building something ingenious, I will kick the genius out of your mind by spilling the beans. So, here comes a highly copy pasted and reused yet my copyrighted and extremely unique program just for you to copy paste and run!

Silly!


But, my evil mind decided, I will put the program in image format instead of text so that, you all can only see it but never touch it. The only way you touch it is by making it. Go and type it :P and save it as Silly.cpp.

Now, I know you all must be wondering what rubbish have we type, let me tell you a bit about the rubbish. The first statement is kind of a book rack’s label, telling you which category of books the rack contains. If the label is fictions, the rack will have Lord of the rings, Harry Potter, etc and if the label is computers, the rack will have 101 ways to die while programming, 20,000 leagues under defects, etc. The Evil Programmers call the rack as Header Files and luckily it doesn’t contain any books!! It contains functions/commands, which solves some specific problems. Like in our program the Header File iostream.h contains the command cout. What this cout does is, it displays a Sentence on the output screen. Like in our program we have cout<<”Oh….blah blah….”; The cout command will display Oh No! I am Silly!!! on the output screen, that’s it!

            We also have various kinds of furniture in C++ and the main ( ) here is kind of a table. We need to place the books on the table to read them comfortably. 

Let’s run the program. To compile (the program we wrote is in .cpp format, that’s just a text file with .cpp extension just to distinguish it from other text files, it’s not a program that can run on the operating system, for windows we need .exe file) click on Execute and then Compile, the hotkey for that is Ctrl+F9. This will create Silly.exe in the same folder where you saved Silly.cpp.

To run the program, click on Execute and then Run, the hotkey for it is Ctrl+F10. Alas! Some black screen just popped up and vanished! Did you see the output? What the hell happened?

Ok! Now stop thinking, let me spill the beans again, the output screen closes because it’s done with showing the output in fraction of a second. Its task is done, it goes back home. But, there are two ways to make it stay, to run the program from command prompt (geeks used DOS prompt before) or give it another task which will depend on us, a task which will make it wait for our response; in programming lingo they call it an input. There’s a silly function in the racks called getchar ( ), that makes the screen persist till we press the Enter key. Try it out (by that I mean type, compile and run!)

More Silly!

It will not stop telling you the truth till you press enter. 

So, now you can see the output till your bulging eyes are soothed. Let's take a coffee break, it's been a long long time I got some fresh air, with all those programmers around it's really suffocating. Cya later, with some more crappy programs.