Thread: Moving on
View Single Post
Old
Nighthawk0973
Senior Member
 
Nighthawk0973's Avatar
 
Status: Offline
Posts: 240
Join Date: May 2011
Location: In front of my computer.
Default 08-08-2011, 05:00 PM

it seems like the book your using isn't using the same compiler as you are. I started with dev-C++ and I have deinstalled it. I prefer Code::Blocks (www.codeblocks.org) but I have MSVC++ for when I learn more about GUIs and want to use them more easily. MSVC++ allows you to drag and drop buttons allowing me to create a web browser before I even knew what 'cout' ment

I recommend 'Buckys C++ Programming Tutorials' it's a series on youtube. I'm still learning it today. It utilizes the same compiler Code::Blocks has. There's also a tutorial series that hte same guy made called 'C++ Programming Tutorials' and it utilizes Dev C++ but isn't as good. If you want a book on Dev-C++ get C++ For Dummies, all in one desk reference. It has 7 C++ books in one ans will teach you what you will need ot know. Example: Networking!!!!

I like Code::Blocks best because it uses an Eclipse style of programming. So when you make Quotation mark 1, it automatically makes Quotation mark 2 and your cursor gets put inbetween, than you can type the contents of the quote, and lastly you just press the -> key (left arrow) to move outside of the quotation marks and continue codeing.

I think Code::Blocks has the '::' in it because of this: (code made by me just know in Code::Blocks)

Quick Note: This works just ran it! Codeblocks automatically returns 0 if your using the 'int main()' function
Code:
#ifndef CODE_H
#define CODE_H

class Code{

    public:
        Code(); //Code classes constructor
        void Blocks(); //void method Blocks
};

#endif
That was a header file called 'Code.h'
Code:
#include <iostream>
#include "Code.h"

using namespace std;

Code::Code(){


}

void Code::Blocks(){ //NOTICE THE PART AFTER VOID: Code::Blocks

    cout << "Get it? Code::Blocks!" << endl; //THIS LINE IS PROBABLY GOING 
    //MAKE THE MOST SENSE TO YOU :D
}
This is Code.cpp, the reason I did the big comments is so you would see
Code:
#include <iostream>
#include "Code.h"

using namespace std;

int main(){

    Code Code; //allows us to execute next line without errors
    Code.Blocks(); //Calls on the method Blocks from code.cpp
}
And the result is:

Code:
Get it? Code::Blocks!

Process Returned 0 <0x0>    execution time : 0.063
Press Any Key To Continue
But the bottom 2 lines are just codeblocks stuff that dissapear when you use more advanced programming I'm sure. It's a fully runnable .exe ready for full distribution now!
   
Reply With Quote