2 Pt.

  1. Write a function that input anpositive integer number and displays the digits of the positive integer number one digit at a time on a separate line from right to left. Keep in mind, the integer number may have any number of digits.

For example, if the input integer number is 9325, the output would be:

5

2

3

9

2 Pt.

  1. Write a recursive function that inputs an int, say n, and returns the sum of all odd reciprocals up to and including n.

2 Pt.

  1. Given a linked list of the following nodes:

struct Node

{

string name;

Node *pNext;

};

Write a function Remove(head,n) that removes the nth element from the list. Your function should input exactly two arguments: the first argument is a pointer to the head of the list and the second argument is an integer that indicates which element needs to be removed. Assume there are more than n nodes in the linked list. Also assume that the nth node is not head or tail and head is the 0th node.

4 Pt.

4. Design and implement a class to represent complex numbers. Acomplex numberis an expression of the form a + bi whereaandb are real numbers and i is an imaginary unit, satisfyingi2= -1. For example, −17.2 + 4.6iis a complex number.

Your class should contain a floatpointer that points to a floating-point array of 2 elements. The real components of the complex number should be stored in this array. The imaginary component should not be stored explicitly.

0 1

Include the following in your class.

  • Constructor with two float input parameters
  • Overload the = operator
  • Overload the + operator [ (a + bi) + (c + di) = (a+c) + (b + d)i ]
  • Overload the == operator[ (a == c) and (b == d) ]
  • Destructor