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; }
```
Computer Science & Information Technology
You might also like to view...
Due to their limited storage capacity and fragility, floppies were replaced by alternate mass storage devices
Indicate whether the statement is true or false.
Computer Science & Information Technology
Imported outlines can have a maximum of nine outline levels.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology