C++0x is now called C++11 (since it wasnt finished last decade) and it has finally been approved. I do plan on getting around to adding some tutorials about the it, but I thought Id do a few on the STL first since thats probably more immediately applicable to most people. Compiler support for C++11 is rather spotty (see
I would like to make a simple game like tic tac toe and snake but unfortunately I dont know how to begin with. Is it normal to look at others code and learn from it. How other people do it?
After I finish this tutorial, I believe I still have so much thing to learn, but I realize that I am not ready at C++.
1there are many sites about coding. Like github. you can create a project share to the world, and people from the world can take part in. and you can check out others project.
I am new here?today is my first to visit here.Please take care of everything.
2) Im not aware of a good source for exercises. Ive always assigned myself projects. What are you interested in? If games, write a game. If finance, write a stock predictor. If graphics, learn some OpenGL. Start simple, and grow it over time. Youll learn a ton by doing things wrong the first time and having to go back and redo them.
My question is, are you planning to write some lessons on data structures and algorithms using c++?
Thankyou for such nice tutorials. I appreciate your efforts.
Not currently. Check back periodically and watch the dates on the front page. Ill update them whenever there is a substantive change.
In the next few lessons, well take a high-level look at the types of containers, algorithms, and iterators that the STL provides. Then in subsequent lessons, well dig into some of the specific classes.
So the obvious question is, what next?. One thing youve probably noticed is that an awful lot of programs use the same concepts over and over again: loops, strings, arrays, sorting, etc Youve probably also noticed that writing programs using non-class versions of containers and common algorithms are error-prone. The good news is that C++ comes with a library that is chock full of reusable classes for you to build programs out of. This library is called The C++ Standard Template Library (STL).
Hey bro, cant believe youre just like me 17 yo and 3 months in C++.But I think you might/may have learnt another language(s) before C++ because I think youre really good at it. Anyway thank for your websites, Ill try my best at there. Cheers!! xD
Most people buy a book, take a course, or learn from a tutorial to learn the language. Its very normal to learn from others programs, but thats better done once you have the fundamentals down.
But maybe its possible to do without fully explaining what templates are.
Woooooooooooot!The official end!From hello world to the end!
2you can search opensource in google and there are many good project too.
Hi Alex, I havent reached this lesson yet, but I want to ask you something that has been stuck in my mind for weeks.
Whats up Quang! I think I can answer you.
I was thinking about adding vectors to the array section the other day. The challenge with teaching vectors is that they use templates, which I dont cover until chapter 14.
However, the code is extremely slow compared to Matlab. My array size are quite large around 50000-by-3.
Done with C++? Start OpenCV C++ Tutorial:
Lol. I literally just finished reading the last section of chapter 17. I went to the main page to say goodbye when I noticed that something had been uploaded in chapter 16. Glad to see you are back Alex. Also, does this mean that c++0x is out?
Good god. Imagine thinking at 17 that youre too old to be a good programmer, come to think of it imagine thinking at 17 youre too old for anything! Wow, talk about putting pressure on yourself. Youre barely out of diapers at 17 and the worlds your lobster. Im 36 and only within the passed 2-3 years have I seriously committed to learning C++. Ive dabbled here and there in Fortran, C, Basic, Pascal (any one remember that?) and more recently looked into Python, Ruby, and Java. Ive found the best why to learn is to put the theory on the back burner, roll-up your sleeves, and get your hands dirty. Set yourself a programming project and get stuck in. Write a Moon Lander game that simulates gravity, make a program to tell you how many days it is till your next birthday from the current date, write a text adventure game, make a fictional banking program where you can deposit, withdraw, and merge bank accounts. Although I detest this phrase it is appropriate; the only limit is your imagination.
17 and worrying about a career head-shake – at 17 I was more worried about my spotty face and had an unhealthy obsession with Baywatch.
If you just started to learn a language, you cant write dictionaries ? No one can expect an expert solution from a beginner. Stack Overflow connects millions of programmers. The answer you see are posted by experts, who faced the same problem years before. If you are just started, dont try to answer people on overflow, just make sure your questions are smart enough to attract people to answer and upvote. If I cant read a piece of code, I dont give much time to understand it. Thats because I know its out of scope for now. Alexs examples are written in a way that are easy to understand for everyone. For example, Quicksort is much faster than selection sort that is used to explain how sorting works in a section. Alex could have picked Quicksort for his example, but thats not for beginners like us. (Personal advice: dont be too quick when learning. Take time, practice and solve some problems using it. Trust me, practice generates questions ? )
where I can find a lot of exercises to practice
I never had any group projects to work on either (until I got to college), so I just made up my own challenges. I wrote a lot of unfinished games. ?
I want to find Unique rows and their corresponding indices from a 2d vector. Im using sort and unique commands from STL, following I use find command in a for-loop to find indices of the unique rows in the original array.
I do intend to cover these topics (eventually). But it could take me a while to get there, depending on where it ultimately slots into the existing lesson structure. I still have a lot of other core language mechanics that I want to write about, like move semantics, and it seems like maybe I should do those first.
because i like how you explain topics and i havent found any other site this effective. So, i am really looking forward to study data structures: linked lists, trees and queues here.
Email(will not be published) (required)
I recommend you teach about vectors in the array portion. They are so much better
Alex, Ive followed your tutorial so far (its pretty good, of course), and Ill keep reading through (16,17, 18, and appendices, as they are now).
The Standard Template Library is a collection of classes that provide templated containers, algorithms, and iterators. If you need a common class or algorithm, odds are the STL has it. The upside is that you can take advantage of these classes without having to write and debug the classes yourself, and the STL does a good job providing reasonably efficient versions of these classes. The downside is that the STL is complex, and can be a little intimidating since everything is templated.
My question is: is there a way to subscribe to your whole tutorial material and be warned, for example, when a specific page gets updated or a new chapter is created?
Fortunately, you can bite off the STL in tiny pieces, using only what you need from it, and ignore the rest until youre ready to tackle it.
I have participated in a lot of forums recently like Stackoverflow, Codeguru, Dreamincode, Spoj,.. but I find myself nowhere among them, I couldnt help them to solve the problems, I couldnt read their code because it was slightly different from yours
I plan to explore the STL in more detail, but havent had the time to actually write much recently. One of the first areas Id like to explore in more detail is containers. But I dont know how soon Im going to be able to get there…
Hello Alex, first I would like to thank u for those tutorials, I really appreciate.
Hi Alex! Thank you for your advice and your time. I will try to learn algorithms after I nearly finish C++. The point is where can I find a project because I think the best way to learn C++ is to have a group/team and do it together so that you can learn from them, but it turns out none of my friends interested in program, so im kinda lonely here!. So thats why i have to search for online exercises and participate in forum. But big thank for your advice, it really helps me out xD!
After I finish this tutorial, I believe I still have so much thing to learn, but I realize that I am not ready at C++. The point is I have participated in a lot of forums recently like Stackoverflow, Codeguru, Dreamincode, Spoj,….. but I find myself nowhere among them, I couldnt help them to solve the problems, I couldnt read their code because it was slightly different from yours.I believe the problem is I have so much theories but just a little experience in coding (although i rewrite your example code a lot). I just want to ask you how can I improve my coding and the capability of reading and understanding others code. And where I can find a lot of exercises to practice. And after I finish C++, which I should learn first: framework, database, UI, web, or other language,…? By the way Im 17 years old and Im a little bit worrying about my career, am I too old to be a good programmer?? Thank you for your time Alex!!
Congratulations! You made it all the way through the primary portion of the tutorial! In the preceding lessons, we covered all the principal C++ language features (excluding those in the C++11 extension to the language).
Hello,everyone!Im a student of a college from China.Im glad to see everyone here.I magorde in c ++ programming.I very like it.My English isnt very good.My e-mail is .I want to make friends with people who speak English.If you interested to me?please leave your e-mail or send a e-mail to me?I very preciate to you,and we can have a chat about c ++ programming or others.I wait your voice.Good luck to everyone!
Dont learn to earn something out of C++, learn it to build something that make things easy for people. And yes you are not too old. I am also of 17 and just 3 months old in C++. Dont stop learning. I am not an expert, just sharing what makes me feel like a good beginner. I enjoy what I learn. You shold too. ?
Youve actually been using the STL since your very first program back inlesson 0.6, when you included iostream. iostream (and our friend cout) are part of the STL!
Can you give more detailed tutorials on STL. I have read the whole 16 chapter and I am getting a feeling it can be more detailed. Like a separate subchapter on each container like vector map etc.I think STL is a very important tool in C++ and has a lot of potential. Btw your tutorials are amazing ?
1) Writing code is as much of an art as it is a science — people have all different kinds of techniques and styles. You may find some techniques and styles more challenging than other, and thats normal. Just keep reading and working to understand. Ask lots of questions. And just as importantly, find challenging projects for yourself. The best way to learn is to do — to run into problems, and then overcome them.
4) You are definitely not too old. Many people dont start programming until they are college age in the US (~18) and they go on to have good careers.
If yes, how much time it would take you to do so?
3in fact, the best is to create a project you love, no matter it is small or big. you can test all your learn, and meet many problems, finally solve them. the experience is better than theory.
Yes, definitely you need to learn much more things. Well, as far as I know, no body can master each portion of a language like C++. There is a huge list of libraries, each one comes with its own set of rules and designed to help you build something without worrying about everything. The question here is, why would you need to know everything. Just focus on tools you will need to work with. For example, if you want to build a scientific calculator, learning how to work with sound libraries is not required. Sure that would be a + point, but you are not forced to learn how to do stuffs with sound libraries, at least for building calculator of a kind.
3) After C++, the next thing I would study is algorithms. Things like sorting, linked lists, maps, etc… (all of which are implemented in the STL). Those will expand your toolkit considerably and allow you to tackle bigger challenges.
And after I finish C++, which I should learn first: framework, database, UI, web, or other language,?
It really depends on what do you want to build. A desktop app? Then learn QT and components yo will need to write your program.
If you want to challenge yourself, check out Projecteuler, HackerRank Codechef etc. Keep in mind that problems available in these sites are tricky enough to solve. First of all, forget about performance and look if you can solve a problem, if you can then try to solve it in a more efficient way. If you are thinking that your final solution is faster than any other solution in the world, you will be amazed after seeing that it takes 5 seconds with your code to be solved, and there is a solution exist that is doing the same job in 5 mili-seconds, have less than 20 lines, and is going out of your head. Thats really normal with us. Dont forget that those solutions are designed by experts. Coders with same level as yours and mine cant do this (Assuming they are not alliens). Just be happy that you can at least solve it. Its not guaranteed that everyone can solve all the problems present on those sites. They write to challenge, not to just let others play with them.