I know this is a Web Developers forum, but you guys are just so nice and helpful, I had to ask this here.
I've decided to start learning C++, and I am in need of a compiler. So I was wondering if anyone here had any personal favorites, or knew of any particularly good ones?
I've never done any programming before, so any help provided would be very much appreciated.
Thousand different paths
So many sterile ends
I chose the Devil's path
Never shall the sun kiss my face
And caress me with it's burning light
For I dwell in the shadows
And sleep side by side with death
I've only done very little work with C++ (when I say very little, I mean as in "Hello, World" little), and I think Bloodshed Dev-C++ is the best free one I've come accross so far. Good luck with everything.
Actually, I did download that. And I Googled "C++ Tutorials" and clicked on this one here. www.cprogramming.com. Well, I follwed the instructions to the letter, 'cept I changed the text of course. And then I Compiled the file.
I got a warning which said, "This file contains at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples including substituting the <X> header for the <X.h> for C++ includes, or <sstrea"
The program won't run either. All it does is just display the text I've typed in. The window in which the program is supposed to be display flashes up for a split second, then just disappears... Puzzling indeed.
Thousand different paths
So many sterile ends
I chose the Devil's path
Never shall the sun kiss my face
And caress me with it's burning light
For I dwell in the shadows
And sleep side by side with death
You need to add extra code for the window to stay open. You can either do that or run it from a command-line. If you want it to stay open after printing the text (or whatever else), add this to the top of your code:
Code:
#include <conio.h>
Then, right before the closing curleybrace of main, use this function:
you will have to remember that C++ is a fairly low level proramming langugae,
it typically does not automatically does things for you,you will have to let it know what to do.
So in your case
you are using a function cout but no declaring it or defining it anywhere,, Since its a library function for spitting data out,you will need to import the library file which is
lol.. kinda offtopic but I love programming... possibilities are endless and it just really appeals to me. Even though I have never tried it, I will try to start learning it soon, once i have a little more experience with PHP, my main goal ATM.
Theres this thing called imperfection. Its the one thing everyones got but nobody wants.
I.. HATE.. EVERYTHING ABOUT YOU! Why do.. I Love you? I HATE Everything about you! Why do I.. love you??? Everytime we lie awake... after every hit we take.. every feeling that i get.. but i haven't missed you yet. only when I stop to think about it... I.. HATE.. EVERYTHING ABOUT YOU! Why do.. I Love you? I HATE Everything about you! Why do I.. love you?
Well, I still have the problem of the program not staying up... the window in which it should display just flickers up for a split second.
Now, I tired something like this:
Code:
#include <iostream.h>
#include <conio.h>
int main() {
int age;
cout<<"Your age here, please:";
cin>>age;
if(age<14) {
cout<<"You are younger than I am.";
}
else if(age==15) {
cout<<"You are my age!";
}
else {
cout<<"You are older than I am.";
}
return 0;
}
And the program runs, asking for my age. But as soon as I type in my age and hit ENTER, the program closes.
Thousand different paths
So many sterile ends
I chose the Devil's path
Never shall the sun kiss my face
And caress me with it's burning light
For I dwell in the shadows
And sleep side by side with death
Originally posted by CardboardHammer Slap this in right BEFORE the return statement:
Code:
cout << "\nPress enter to quit.";
getch();
That didn't work for me, but try this:
cout << "\nPress any key to continue" << endl;
getche();
Those should go right before the return statement...
And my recommendation for a compiler is Visual C++ 6.0. The bottom line is it rocks and I've never seen anything that compares. The down side is that it is not free...
Well, the new version of the Visual Studio is actually the .NET edition, but I don't like that as much for just plain old C/C++ programming. The .NET edition is really nice, too, but I prefer the 6.0 for C/C++. If I'm using VB, then I definately use .NET. As for the price, though, I think you can get the standard edition for just over $100 or so. If you buy it used, you might be able to get it for cheaper, I don't know...
One more thing is if I were you I would check if you can get the academic edition, since it is much cheaper. As long as your still a student, you should be able to get it. It's not the easiest thing to find on their site, though, so you'll have to look around.
Bookmarks