Max*_*xpm 1 c++ string namespaces header std
我的头文件如下:
#include <iostream>
#include <string>
#include <windows.h>
#include <math.h>
//using namespace std;
std::string StringMultiply(string Str, int Mult)
{
std::string Return;
for (int Index = 0; Index <= Mult; Index++)
{
Return += Str;
}
return Return;
}
Run Code Online (Sandbox Code Playgroud)
编译它会产生大量错误,其中大部分都与缺少string数据类型有关.取消注释该using namespace std;行修复了它,但我被告知这是头文件中的错误做法.
更改
std::string StringMultiply(string Str, int Mult)
Run Code Online (Sandbox Code Playgroud)
至
std::string StringMultiply(std::string Str, int Mult)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6258 次 |
| 最近记录: |