can someone give me exercises on pointers?
or give me a link
i was implementing my game with pointers but i dont know when or where to put pointers so i think i need to practice , i havent wrote a program using pointers since i learned pointers
Here you go. Exercises from C++ Primer Plus by Stephen Prata.
1. Someone runs a pizza analysis service. for each pizza, he needs to record the following information.
- name, which can consist more than one word
- diameter
- weight
devise a dynamic structure with new and write a program that uses a pointers to structure element. The program should ask the user to enter each of the preceding items (as following: diameter, name and weight) and then display that information. Use cin (or its methods) and cout.
2. design a structure called cars with following informations: make, as a string object or char array, and the year it was built as an integer. Write a program that asks the user how many cars to catalog. the program then should create a dynamic array of that many car structures. next it should prompt the user to input all the data for all cars he wanted to catalog. Then displays the data.
Implement a doubly-linked list (not a singly-linked list). Once you do that you can confidently say that you know pointers. At least that's what I did before I could fully comprehend pointers.