Here is a recursive function. Write an iterative version of it. Hint: Be sure you get the number of copies of "Hip" right.
```
void rec_cheers(int n)
{ using namespace std; if(1==n) cout << "Hurray!" << endl; else { cout << "Hip, "; rec_cheers(n-1);
}
}
```
```
void iter_cheers(int n) { for(int i = 0;i < n-1;i++)//this is the tricky part!
cout << "Hip, "; cout << "Hurray!" << endl; }
```
You might also like to view...
How many Book objects are created by the following statement? Book[] books = new Book[10];
a. 10 b. 0 c. 5 d. None of the above.
What are logical cluster numbers (LCNs)?
What will be an ideal response?
What should you do if you want to be able locate your laptop in the event of loss or theft and give it a command through the internet to lock it or delete data.
A. set a Bios No access password B. subscribe to LOJack for laptops C. enable the GPS module in the BIOS D. install a high-power wifi card
Describe why we need the IPv4-to-IPv6 transition mechanisms.
What will be an ideal response?