Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 08-08-2011, 03:37 PM

Only syntax errors. Firstly it is endl with an 'l' not end1 with a '1.' Secondly you forgot to use the insertion operators for ever endl;

For example you did:

Code:
cout<<"Hello we are about to learn about the functions" end1;
But it should be:

Code:
cout << "Hello we are about to learn about the functions" << endl;


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
Reply With Quote
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, 04: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
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 08-08-2011, 07:32 PM

Wow. Just wow. Code blocks is actually really cool. I remeber that my teacher once said to me to use it but I don't listen too often. The good part though is that it uses a standard compiler for C++ which means that all that I have showed you Belso isn't wholefully useless. So yeah download code blocks it is 1000000x better than Dev, only wish I stated using it before. Thanks NightHawk, but uh don't you think it is a little early to show him OOP?


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
Reply With Quote
Old
belso
Member
 
Status: Offline
Posts: 42
Join Date: Jan 2010
Default 08-08-2011, 07:58 PM

Ok i will download code blocks and i have realized how different my book is and i will go use a different book


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//
   
Reply With Quote
Old
belso
Member
 
Status: Offline
Posts: 42
Join Date: Jan 2010
Default 08-09-2011, 02:49 PM

Ok i do not get codeblocks at all i am completely stumped.


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//
   
Reply With Quote
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 08-09-2011, 05:31 PM

Okay what do you mean exactly? Do you mean which version to download ,or how to make a program or what?


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
Reply With Quote
Old
Nighthawk0973
Senior Member
 
Nighthawk0973's Avatar
 
Status: Offline
Posts: 240
Join Date: May 2011
Location: In front of my computer.
Default 08-09-2011, 06:29 PM

I hope your not attempting the code that I wrote... that was not ment to be your level at all. I was just saying that I'm pretty sure that's why there's the double colons in the middle of Code and Blocks. (Get it? Code::Blocks! )

Anyways here's how you start codeblocks. File->New->Project

inside your project there's a file called 'main.cpp' inside your main.cpp type the following:

Code:
#include <iostream>

using namespace std;

int main(){

   cout << "Hello World, but in Code::Blocks!" << endl;
}
This will print out a Code::Blocks hello world. Don't add the return 0; because it already does that with codeblocks.

@legolizard
Yeah. I always strive to find the best IDE. Best Java IDE is Eclipse. Best C++ IDE is Code::Blocks, best VB IDE... I have no clue
(Best HTML IDE that I know of is JCreator)
   
Reply With Quote
?
Old
belso
Member
 
Status: Offline
Posts: 42
Join Date: Jan 2010
Default ? - 08-09-2011, 07:38 PM

Ok i installed it but when i go into where i make a project i dont see the main thing that you were talking about so i cant code anything. Maybe i did install it wrong


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//
   
Reply With Quote
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 08-09-2011, 08:28 PM

If you look at the left you will see a tab called "projects" make sure you have that tab open and you see something that says "workspace." Make sure you click it and two other things will pop down. Now you should see a + butt0n next to "Source." Click the plus sign and and another file will popup called main.cpp.. Click it and TA DA!


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein

Last edited by legolizard; 08-10-2011 at 10:23 AM. Reason: typos
   
Reply With Quote
Old
belso
Member
 
Status: Offline
Posts: 42
Join Date: Jan 2010
Default 08-10-2011, 11:40 AM

Alright i found it and i can do code now but when i made the code the nighthawk did i go to build and run and it dosent do anything


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.