使用`using`关键字可以简化代码中对命名空间的引用。
`using std::sin;`的作用是将`std`命名空间中的`sin`函数引入当前作用域,使得可以直接使用`sin`函数而不需要加上命名空间前缀。
例如:
```cpp
#include <iostream>
#include <cmath>
using std::sin;
int main() {
double angle = 1.0;
double result = sin(angle);
std::cout << "Sin(" << angle << ") = " << result << std::endl;
return 0;
}
```
在上面的示例代码中,我们通过`using std::sin;`将`std`命名空间中的`sin`函数引入到`main`函数的作用域中,这样就可以直接使用`sin()`函数计算角度的正弦值。