Here is what I have so far:
Code:
#include <iostream>#include <string>
using namespace std;
//recursive function prototype
string intToStr(int n);
//main
int main()
{
/*/int tests[] = {
0, 100, -5, 10, 5, 10302
};
const int B = 6;
for (int i=0; i<B; i++)
{
cout << "Converting the integer "<< tests[i] <<" to string: ";
cout << intToStr(tests[i]) << endl;
}*/
int num;
cout<<"Please input a number: ";
cin>>num;
cout<<endl;
cout<<"Converting the integer "<<num<<" to a string: ";
cout<<intToStr(num)<<endl;
//string str;
system("PUASE");
return 0;
}
string intToStr(int n)
{
if (
}
I need help with setting up the base case. I think it looks like this for int 0?
if(?==0) return 0;
How do you convert that to a string and return it?