C++ Test Review Help Please

I am in a beginning level C++ class, and I haven't been doing so well. The next test is on Thursday, and here are the subjects I am having trouble with. Please help if you can.

Overloading functions- definitions, how to do it

template functions(examples if you have them please)

call-by-value and call-by-reference- differences, benefits

how to write a function

default values

static variables

register storage class

recursive (doesn't that mean it calls itself?)

auto storage

Thanks in advance for any help you can provide on any of these topics!
http://tinyurl.com/4ubxg3c


Rinse and repeat with the following questions :p

Seriously though if you want definitions then google really helps. If you want an example test then you should ask that.
Also, you could just look at the relevant parts of the tutorial here at cplusplus.com!

http://cplusplus.com/doc/tutorial/
Oh, ok thanks! Sorry I just lurk here, didn't really think of that. Anyway, an example test would be great... should I start a new thread on that??
You want one of us to write you a sample test in C++?
@ComputerGeek well maybe just tell me a function to write and I do it? That is what I would be doing on the test. Not an entire program. Just a function.
Write a function to compute the factorial of a positive integer?

EDIT: That is, if you have encountered factorials in maths classes.
Last edited on
How about this: Write a function to recursivly "Square A Circle" http://en.wikipedia.org/wiki/Squaring_the_circle
This I know you've run into in math class, that is if you're an American or Canadian.

EDIT: This obviously doesn't have a finite answer, you would need to either pass it a given number of iterations or something like that. I'll leave that part up to you.
Last edited on
All of your answers can be easily googled:
1. overloading function - It is using the same name for two or more functions. The compiler determines which function to use based on the type of function, arguments passed to it and type of values returned.
2. template functions - http://www.cplusplus.com/doc/tutorial/templates/
3. cell by value/program - http://www.exforsys.com/tutorials/c-language/call-by-value-and-call-by-reference.html
4. how to write a function - http://www.onlinecomputersciencedegree.com/
5. default values - an option chosen by the computer automatically in the absence of explicit instructions by the human operator.
6. static variables - variable that retains the same data throughout the execution of a program
7. register storage class - http://www.tutorialspoint.com/ansi_c/c_storage_classes.htm
8. recursive - used to define an object in terms of itself
9. auto storage - lets you explicitly declare a variable with automatic storage. The auto storage class is the default for variables declared inside a block. A variable x that has automatic storage is deleted when the block in which x was declared exits.

Good luck on your test--try taking some practice quizzes online before the real thing.
great example! Thanks guys! I'll try it and both post it here sometime tonight and send it to my teacher(I told him I posted his review online haha) thanks a bunch!
Write a linked list (of ints) library: create, destroy, isEmpty, count, insert, remove
Add split: Splits a linked list into 2 lists with each one half of the original elements
Add mix: appends two sorted lists so that the resulting list is still sorted
Add mixsort: Sorts a list using split and mix
Add permutate: prints all permutations of the list.
Topic archived. No new replies allowed.