What is the Recursive case? void recurPrt(int n); int main() { recurPrt(3); system("Pause"); return 0; } void recurPrt(int n) { if (n != 1) // Line 1 { cout << "Hip\n"; //Line 2 cout << "Hip\n"; //Line 3 cout << "\nDone?\n" << endl; // Line 4 recurPrt(n - 1); // Line 5 cout << "\nHorray! " << n << endl; // Line 6 cout << "\nAgain?\n" << endl; // Line 7 } else cout << "Yeah\n"; //Line 8 }
What is the Recursive case?
void recurPrt(int n);
int main()
{
recurPrt(3);
system("Pause");
return 0;
}
void recurPrt(int n)
{
if (n != 1) // Line 1
{
cout << "Hip\n"; //Line 2
cout << "Hip\n"; //Line 3
cout << "\nDone?\n" << endl; // Line 4
recurPrt(n - 1); // Line 5
cout << "\nHorray! " << n << endl; // Line 6
cout << "\nAgain?\n" << endl; // Line 7
}
else cout << "Yeah\n"; //Line 8
}
Step by step
Solved in 2 steps