Beginner's Lesson in C++

Pages: 12
Hi I'm Twelve and need to learn C++, please help!
Go to http://www.cprogramming.com/tutorial/lesson1.html It's nowhere near as good as a personal teacher but it's got all the basic info you'll need
Last edited on
here is the basic program

1
2
3
4
5
6
7
#include <iostream>// ms dos heder
int main()
{
cout<< "Helow werold!; // displays a text
system("pause");// waits untel you pres eny key
retern 0;
} 
Wanting rather than needing to learn it would be a good start. The tutorial on here is a very good starting point and then google for the next step once you have decided what you actually want to write.
As TonyMUK said, this site's tutorial is pretty good:
http://www.cplusplus.com/doc/tutorial/

EDIT: Of course, a good book will likely be better than most (if not all) online tutorials.
EDIT EDIT: Also, coincidentally, be very careful with video tutorials - a lot of the ones on YouTube are misleading...

@ty98 Be careful with the use of system. There are various reasons for not using it ;)
Consider this as an alternative hello world program:
1
2
3
4
5
6
7
8
#include <iostream>

int main()
{
   std::cout << "Hello World!" << std::endl;
   std::cin.get();
   return 0;
}
Last edited on
I could not remember how to use the cin.get();
command!!!
First things first - you need software to compile and run your code.

https://www.dreamspark.com/default.aspx
Students can download Microsoft Visual C++ 2008 Express edition for free (they will need to register however); I can't remember if this relies on a student e-mail account or other verification method mind...

Alternatively Dev C++ I've heard good things about.

For actually learning, the guides on both this site and cprogramming.com are fairly good, but not perfect - they can't beat a teacher.

Might I ask why you feel you need to learn it? Is it for a college course?
Students can download Microsoft Visual C++ 2008 Express edition for free

Actually anyone can download Microsoft Visual C++ 2008 Express for free, or indeed Visual C++ 2010:
http://www.microsoft.com/express/Downloads/#2010-Visual-CPP

However, via Dreamspark, students can download Visual Studio Professional for free.

Also, I would recommend Code::Blocks rather than DevC++.
DevC++ is old, buggy and unsupported.
(See here for details http://cplusplus.com/forum/articles/36896/ )

Regards
-Xander314
Last edited on
I was going off what my brother had said about DevC++; he's started learning C++ using it. I'll pass the article on to him.

And C++ 2008 Express being free for all, even better!

Though thinking back to when I was starting getting Visual C++ to start a new project could be cumbersome at first. Code::Blocks has a tutorial on the Cprogramming site.


So...yeah - what Xander said :P
Dev-C++ has actually made new programming software. Not a substantially different program but its better. You can get it for free at sourceforge.com. Not yet sure of sourceforge's reliability but I haven't had any problems so far.
I really wouldn't recommend Visual c++ 2010 for someone wanting to learn c++. It does too much in the background rather than you coding everything yourself. It also needs a runtime to be installed to run any of your programs on PCs that don't have visual studio installed.
My personal preference is Code::Blocks with MinGW.
Is there any really huge difference between all programming software or is it all really just what somebody likes better?
It's probably just what someone likes better.

GRex2592 wrote:
Dev-C++ has actually made new programming software.

Are you referring to wxDevC++? If so, then yes. This is fine to use. It is the original DevC++ which should not be used.

TonyMUK wrote:
I really wouldn't recommend Visual c++ 2010 for someone wanting to learn c++

Provided you create an empty project, I am not sure it does much in the background. Perhaps you are referring to all the MFC, ATL, etc code which it can generate for you. This isn't a problem in my opinion as new developers most likely won't use it anyway.

In my opinion, Visual C++ 2010 is an excellent choice for beginners as the relatively good Code Prediction and other Intellisense features help you if you can't remember the names of symbols or arguments of functions.
So the new DevC++ is good. It's, of course, not perfect yet though cause its in beta testing I believe. I find it good cause you can highlight a variable and tell what kind it is instead of searching for it in your code. It shows you in a little pop-up window.
Well I can't actually comment, as I haven't used it. However, I know that wxDevC++ was suggested as an alternative to DevC++ in the article on this site "Why we've deprecated DevC++".

As for the hover text about variables, Visual C++ does that as well. I don't know how I would manage without all these features XD
I actually use wxDev-C++, and yes it is good. I recommend it for anyone coming off of Bloodshed because it's so visually simular that you won't notice a difference.

I prefer wxDev over Code::Blocks because the configuration information for each project is held in that projects folder instead of one global setting. So you can switch between one project and another without having to reconfigure a bunch of stuff, something that I didn't have the patience to figure out with Code::Blocks.
I think main of the build under global settings in Code::Blocks may also be accessed on a per project basis via Project -> Properties and then clicking "Project's Build Options".
I actually mean the build paths and everything else. It gets so annoying having to redo this just because I work on 3 or 4 programs at a time. With wxDev-C++ you open a project by double clicking on a .dev folder, your layout is saved to another file that is also in the same project folder and everything is just so much easier to switch between.
@Computergeek01 well, if you get tired of project configuration, you can always go low-tech and use cmake - since configuration is all text files, it's all transparent. It's also cross-platform so will work as well on windows as on *nix systems. I use the same set of cmake configuration files for building on Linux and in OSX, with minor tweaks as needed.

I use it to configure code / builds in many languages, including special builds like doxygen documentation or valgrind and google unit-testing

@OP
but like Xander314 mentioned, it's all a matter of preferences; in general, you have a set up which you are comfortable and proficient in, and you don't feel like learning something new to do the same thing, which actually makes sense.

people only switch when they are unsatisfied with their current setup, or get curious about IDE vs non-IDE setups.

in the end, use what works for you
@ kfmfe04: I actually started to do that, but then I caught myself writing up a seperate batch file to do all of the arguments and such.

I actually do go "Low Tech" once in a while because I don't like how wxDev plays with cl.exe (M$'s compiler). But that's not often and I already understand how the whole suite works so there's no additional benefit for me, it's just redundency.
Pages: 12