C++中的函数声明小疑点

C++中的函数声明小问题
在C++中,当我们声明要调用的函数,是在using namespace std;后面还是在main函数中声明?两者又有什么不同?

------解决方案--------------------
探讨
在C++中,当我们声明要调用的函数,是在using namespace std;后面还是在main函数中声明?两者又有什么不同?

------解决方案--------------------
C/C++ code

#include <iostream>
using namespace std;
void fun();

int main()
{
    cout<<"main"<<endl;
    fun();
    return 0;
}

void fun()
{
    cout<<"fun"<<endl;
}
//这种方式的输出为 main fun

#include <iostream>
void fun();

int main()
{
    using namespace std;
    cout<<"main"<<endl;
    fun();
    return 0;
}

void fun()
{
    cout<<"fun"<<endl;
}
//这种方式编译器会报错误说,fun函数里的cout和endl没有定义