// 程序文件:1.cpp
#include <iostream>
using namespace std;
void fun(int x)
{
if (x < 0)
{
cout << ‘-‘; x = -x;
}
while (x != 0)
{
cout << x%10; x /= 10;
}
cout << endl;
}
void fun(char *str)
{
int N = 0;
while (str[N] != ‘\0’) N++;
for (int n = N-1; n >= 0; n--)
cout << str[n];
cout << endl;
}
// 程序文件:2.cpp
#include <iostream>
using namespace std;
extern void fun(int x);
extern void fun(char *str);
int main( )
{
fun( -2015 );
fun( “-2015” );
return 0;
}
添加回答
举报
0/150
提交
取消