I am teaching myself C++. I have followed the basics.
Declarations of the int Main
control mechanisms (if statement, loops, case switch)
I get the concept of functions
I understand classes in short term.
I understand arrays and I get pointers.
I understand the basic file stream capabilities of c++.
I know not C++ but I do have experience with the basics of programming:
1. I have written a web workflow application in PHP.
2. I am capable of reading code like VB, ASP, and Javascript.
I get the very basics.
In teaching myself programming I find it difficult to come up with ideas to program full applications and I come up with applications that are beyond my ability to program.
I hate surfing the web for tutorials that are all over the board and unstructured. The tutorial info on this site is great but its the programming practice that I need.
Does anyone know of any sources where there are a lot of programming exercises or maybe a good book with repetitive exercises that will help build your competency in programming?
Any other creative ideas from any self-learners out there?
C++ Primer (4th ed is the newest) is a great book, I use it. It's rather poorly organized in my opinion but it works pretty well for teaching and reference. However it's also not cheap ($40 as I recall). The exercises on this website, and the programming tutorials here, are also pretty good.
You could use the MIT class on C++. MIT has put all their courses online under their OpenCourseWare program, and they have a class called Introduction to C++ which I used and which has very good exercises, along with solutions. Take a look at this link:
Needless to say (but I will say it anyway), it helps to break your head trying to do the problems yourself before looking at the solutions (which are also provided).
If you are interested in more advanced stuff, there is another course at MIT, Foundations of Software Engineering, which is excellent. This gets into all the really fun stuff, like inheritance and polymorphism as well. The programming problems there are really good, and make you think. Helped me a lot. Again, resist the temptation to peek at the solutions. This course is part C++ and part Java; I only studied the C++ stuff since I am not working with Java. But even that is very good. This is the link:
The MIT open courseware is the greatest thing on the NET I think.
I went over the C++ course and that is how I found out about this site. The problem sets are short, not a lot of practice. The course gives you a general idea of programming.
I wanted to get to the Python Programming course but that is time intensive and not what I need at the moment.
Here's one I just did, I had some problem with parsing command line arguments at first, and got a few seg fault errors ( trying to access array elements that didn't exist ). But the rest of it was pretty easy, and completed in a day. Also this would put to the test all the things you just listed.
Let me know if it's too easy or hard and I can give you another assignment in lesser or greater difficulty... just PM me.
The problem
Read strings from a text file and store in an array of non-duplicate strings ( the
array has room for a maximum of 100 strings). When the input file is finished
you are to sort the strings and finally output the array contents to an output
file.
You must read and store C++ string class items, NOT C strings, which are
completely different … so don't search the web, you will be assessed using the
material covered in the notes and in class. If you store C string then you will
not pass.
**Some other things to mention: you should use an array not vector, no templates. you should implement a sort don't use c++ sort. Wikipedia has some great examples of sort ( I mean GREAT! ). **
The name of the input file and output file are obtained from the command line,
as specified follows
a2 -i NameOfInputFile -o NameOfOutputFile
OR
a2 -o NameOfOutputFile -i NameOfInputFile
Question – What types of command line problems are to be handled? Answer –
things like incorrect command line options, missing command line options,
input and output file names cannot be the same, etc.
Question – If the command is OK can there still be problems? Answer – yes
but this are handled elsewhere. Types of problems include – can't open file (for
whatever reason … you are to provide meaningful error messages and
terminate program).
Question – what is the structure of the input file? Answer – one string per line,
and there are no blank lines.
Question – will the storage array ever fill up? Answer – maybe yes maybe no,
it depends on the input from the input file.
Question – if the storage array fills up what do I do? Answer – stop processing
the input file (because you can't store anything else), and continue with the
rest of the solution.
Question – can the input file contain no strings? Answer – yes, and your
program should still run correctly, it's just that the output file created will be
empty.
Question – what is the structure of the output file? Answer – one string per
line, but the lines are obviously in sorted order.