Welcome! Log In Create A New Profile

Advanced

Learning C++ compiler ?

Posted by a420nyer 
Learning C++ compiler ?
March 22, 2009 05:35AM
I am starting to Learn C++ in 21 days and was wondering if Borland 5.5 C++ is a good compiler to start with



Edited 1 time(s). Last edit at 03/22/2009 05:36AM by a420nyer.
Re: Learning C++ compiler ?
March 22, 2009 06:20AM
OK I need an honest answer (no matter how harsh) I'm trying to keep with tradition and make HELLO.cpp, I have the Sam's Teach yourself C++ in 21 days. The book makes it sound like a four year old could do it, and yet I'm totally lost is this a sign that maybe I'm not as computer literate as I thought and this is way over my head? The book says "just" compile it, link it and run it (that isn't "Need no previous programing knowledge" to me. I've always wanted to make my own programs and I thought because I was familiar with DOS this book was all I would need, but if I'm this lost in the first chapter I feel doomed.
Re: Learning C++ compiler ?
March 22, 2009 06:34AM
I've never met a person who read that book and then could program c++. Just stick at it. Unless you have a genius IQ there's no way you could learn c++ in 21 days.

I read it years ago and felt totally confused too - It just takes time and practice. I actually found it more helpful searching around the net for c/c++ tutorials than reading that book. However it's a good reference to have.

Another option is just learning C. C++ can be hard to learn if you've not done object oriented programming. You can do everything in C that you can do in C++ in devkitpro.
Re: Learning C++ compiler ?
March 22, 2009 12:52PM
Hey, C++ in 21 days was my first and only C++ book. And look at me now scanff ;)

Anyways, I reccomend the Dev-C++ IDE (its free too) over Borland any day.

Just hang in there. Day 1 is only confusing if you've never programmed before in anything. I swear it gets easier as you go further.
Re: Learning C++ compiler ?
March 22, 2009 02:26PM
I downloaded Dev-C++ and already like it better than Borland, but I still cannot get hello.cpp to run. I know I'm just starting but it is really discouraging that with step by step instructions I can't get this simple program to run. I found that the Hello World program is built into Dev-C++ but when I opened it up it looks a lot different then what the book told me to type and the book was clear that I should type it exactly like it showed. My big ? is should I move on or (what I'm thinking) if I can't do this than I won't be able to do the future steps. NOTE: I hope I don't seem like a whiner but I am so excited about learning to program, and having so much trouble getting the first "simple" program to run is bringing out the negativity in me. I understand that programming is sometimes a tedious task and I'm fine with that, but I like to understand what I'm doing wrong and I don't. I did get Dev-C++ to create a .exe after compiling but when I ran it, a flash of a DOS looking window came up, but it was so fast I couldn't even tell if it had words on it.



Edited 2 time(s). Last edit at 03/22/2009 02:49PM by a420nyer.
Re: Learning C++ compiler ?
March 22, 2009 02:50PM
Just type in whats in your book (do not type in the line numbers btw).

Or copy and paste this into dev-c++:

#include (iostream)

int main(){

std::cout << "Hello World!";

int pause;

std::cin >> pause;

return 0;
}

After you have your code done, go to the top of dev-c++. Click compile, a pull down menu will appear. Then click compile and run. You will be prompted to save your file, so do that. Save it wherever you want just make sure you save it with the extension .cpp After that, dev-c++ will compile and run the program. A black console window should open up saying Hello World.

I hope that helps.

Best of luck,
Arikado

Edit: Phorum software wont show all of my first line of code. So after you copy and paste it, change ( to < and change ) to >



Edited 3 time(s). Last edit at 03/22/2009 02:52PM by Arikado.
Re: Learning C++ compiler ?
March 22, 2009 04:32PM
My suggestion would be MinGW + CodeBlocks IDE. Or MinGW + Programmers Notepad (that comes with devkitPro), although this last one needs a Makefile for compilling by default.
Re: Learning C++ compiler ?
March 22, 2009 04:38PM
If you're learning C++ then I really have to say Dev-C++ is really the easiest thing to use. Its far more user friendly than every other IDE I've ever tried (that includes visual studio, borland, and the ones daniel hueho mentioned above).

Also, Daniel Hueho, every IDE can work with devkitPRO. Some just take more configuration than others. Programmers Notepad needs no configuration which is why its shipped with and reccomended for use with devkitPRO.
Re: Learning C++ compiler ?
March 23, 2009 12:51AM
Codeblocks is the way to go. DevC++ is years outa date. But for learning purposes DevC++ will work.

My reasoning for first learning C is I personally found it easier to pick up, reading about inheritance etc was very, very confusing to a Visual Basic 3 programmer at the time :)

#include 
#include 
#include 

int main()
{
    printf("Hello world!\n");
    printf("Press x to exit!\n");

    while (1) {
       int c = getch();
       if(c=='x') break;
    }
    
return 0;
}
Re: Learning C++ compiler ?
March 23, 2009 04:51AM
Thanks for all the help everyone, but I spent about 5hrs off and on today and I still cannot get Hello World! to work, even when I got it to compile without errors it still didn't run right. And I'm thinking even if I got the codes you guys are showing me to work, since they are a lot different then whats in the book, then the future lines of code in the book aren't going to work for me either. Should I keep going forward even though I never got hello world! to work, or will moving on without getting the first "simple" program to work just make the next that much harder?



Edited 1 time(s). Last edit at 03/23/2009 06:19AM by a420nyer.
Re: Learning C++ compiler ?
March 23, 2009 12:28PM
When you say, it didnt work right, do you mean it just flashed on the screen for a second and then disappeared?

If so, keep reading in day and Mr. Liberty will show you an alternate version of Hello World that will stay on the screen. (It looks just like the code I posted above).

And it really does get easier as you go along. But you have to stick with it to figure that out.



Edited 1 time(s). Last edit at 03/23/2009 12:28PM by Arikado.
Re: Learning C++ compiler ?
March 23, 2009 08:20PM
Yeah It flashes on the screen then ends because it WORKED! the simple hello world just runs prints "hello world" and exits that program. That's why you'd need a getch() or std::cin >> pause; to make it visible to you. Also if you ran the code in a console window/terminal you'd see that it worked.
Re: Learning C++ compiler ?
March 24, 2009 06:31AM
That is what happened (so fast I haven't even seen the words Hello World!), this is very encouraging. Thank you both.
Sorry, only registered users may post in this forum.

Click here to login