To anyone who knows C/C++/VC++ I need to know where I can find C++ exercises. I am currently reading........

faceplate

Member
Jun 21, 2001
51
0
0
Hello everyone. I am currently reading Beginning Visual C++ 6.0 by Ivor Horton. Here is the amazon site for it. I heard it is a really good book. It is really big. The first half covers the basics of the C++ language, and the second half covers the basics of windows programming. I have messed aroung with QBasic and Visual Basic before. I also know Pascal. This is my first endevor in C++. My problem is the book has exercises, but not enought. I am not very far yet. I am at functions, arrays, pointers, and references. The thing is I understand what is in the book, but when it comes to writing my own programs, I am stumped. I have not programmed in a while, and I have lost the mindset. I also can't rattle the syntax quickly off my mind. I need to do a lot of basic program writing to drill it into my head. I would like to know where I can find some descriptions of programs I could write, and then maybe check my code against some "correct" code. Does anyone know where I could find a site like this. I appreciate any help.
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Are you using the 'Visual' part of VC++ (MFC etc.) or just doing standard C++? What helped me, when I was learning, was trying to do projects that would be useful for me in everyday computer use. Then I would go off learning the part where I was stuck at. It's not the fastest way to learn, but in the long run it pays off quite well.
 

faceplate

Member
Jun 21, 2001
51
0
0
I am still learning the standard C++. I know I could think of some random things to code in my head, but I would rather have an assignment with specific goals. Thanks
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Originally posted by: faceplate
I am still learning the standard C++. I know I could think of some random things to code in my head, but I would rather have an assignment with specific goals. Thanks

Have you done all the regular projects? Here is a list of simple projects I did in my introductory C++ course (2nd semester):
- A Complex number class w/ implementation for operators like +/-/division/mul etc.
- A search/sorting program allowing the users to perform binary search
- A calculator program using the aforementioned complex number class
- A linked list implementation (not using templates)
- A doubly linked list imp.
- A Roman Numberal class (operator support provided) - uses the doubly linked list class
- A stastics program that reads a file and gives stats for #ofwords, #ofsentences, #ofparagraphs etc.
- An address book program that reads a file -> writes sorted output as well as performs search for names etc.
- A Maze solving program. Maze is defined using a file with the starting and ending positions defined. Output is the list of steps to solve the maze

All the assignments above were pretty vague as far as the specification to allow the student maximum freedom in implementation.
 

faceplate

Member
Jun 21, 2001
51
0
0
hmmm, most of the things you mentioned are beyond my level. I know only the basic things like arrays and functions. I really need practice. Maybe I should get a short book focus on learning the basics of C++.
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Originally posted by: faceplate
hmmm, most of the things you mentioned are beyond my level. I know only the basic things like arrays and functions. I really need practice. Maybe I should get a short book focus on learning the basics of C++.

That would be advisable :)
 

MGMorden

Diamond Member
Jul 4, 2000
3,348
0
76
Just try to do some simple mathematical things.

Write things like fake drink machine programs, where the person can insert dime, nickel, quarter, etc. The machine counts that up and then will give them back the right change in the fewest amount of coins (better excercise would be to keep track of the coins inserted. at first you have no change so the customer has to have exact change. after a few drinks have been bought the machine can dispense only change that it has).

write a paper, rock, scissors game. It's a very simple concept that should be fun.

Little bank programs for just calculating interest over a period of time is good practice too. Right now in the early stages I'd say it's more important to get a grasp on how the language works in a general sense than to delve into a really complicated project (though I remember years ago a guy who learned either C or C++ just to write an SNES emulator. that's dedicated :)). Do try and get some specific focus on things though. Be sure to practice file i/o, and especially your data structures (Multi-dimensional arrays, self-balancing trees, hash tables, B-trees, stacks, heaps, queues, etc. too many people just learn to use a list or an array in all cases. learn which one works best for different problems).

After you get the basics down and these little programs feel beneath you then you definately want to try some of singh's suggestions (the maze problem was fun way back when I did it). You might also want to try some of the classic problems like towers of hanoi (look it up). I think I've done all of those in either C++ or Java EXCEPT the Roman numeral class (that's a new one on me :)).
 

XValde

Junior Member
Aug 4, 2002
2
0
0
Here is a great little site for beginners and advanced C++ addicts CPP-Home. They run a few coding contests with varing levels of difficulty (beginner to advanced), although most of them involve solving or finding mathematical expressions using C++. They include the winner's code for the past contests. They also have C++ tests for those coders who think they know it all about the language and beginners. There's a few tutorials too. Check it out, the contests may seem a little tough at first for a beginner, but you will only learn by challenging yourself, and this is a good place to start.