C++ recursive function

User Generated

2s50

Programming

Description

how would I write these functions recursively in c++

int account::findAccount(int acctNumber, account accts[MAX], int count)

{

for (int i = 0; i < count; i++)

{

if (accts[i].acctNumber == acctNumber)

return i;

}

return -1;

}


And this function as well

void account::displayAll(account accts[MAX], int count)

{

for (int i = 0; i < count; i++)

{

accts[i].displayAccount();

cout << endl;

}

}

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Anonymous
This is great! Exactly what I wanted.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4