将传入的字符串反向输出到控制台,求空白处代码
#include <iostream>using namespace std;
voidrevPrint(const char* str)
{
if(*str == '\0')
______;
revPrint( ______ );
cout<<(*str);
}
int main()
{
revPrint("Hello"); //输出:olleH
return 0;
}
#include <iostream>
using namespace std;
voidrevPrint(const char* str)
{
if(*str == '\0')
return;//结束递归
revPrint(str+1);//指向下一个字符
cout<<(*str);
}
int main()
{
revPrint("Hello"); //输出:olleH
return 0;
}
页:
[1]