Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误:';CLSS&x27;是否未在此范围内声明?_C++ - Fatal编程技术网

C++ 错误:';CLSS&x27;是否未在此范围内声明?

C++ 错误:';CLSS&x27;是否未在此范围内声明?,c++,C++,为什么我的函数“CSS()”不能在此代码中工作,错误是: C:\Users\KEstudio\Desktop\Programming\Learning C++ resources\projects\homework saver\main.cpp||In function 'int main()':| C:\Users\KEstudio\Desktop\Programming\Learning C++ resources\projects\homework saver\main.cp

为什么我的函数“CSS()”不能在此代码中工作,错误是:

C:\Users\KEstudio\Desktop\Programming\Learning C++ resources\projects\homework     saver\main.cpp||In function 'int main()':|
C:\Users\KEstudio\Desktop\Programming\Learning C++ resources\projects\homework    saver\main.cpp|20|error: 'CLSS' was not declared in this scope|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|
这是我的密码:

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;

void ClSS()
{
    system("CLS");
}
const char* CTS(string);

int main()
{
    A:
    string HWS, HW;//We will be saving our input in this
    cout << "Please enter the homework subject:" << endl;
    getline(cin, HWS);
    CLSS();

    cout << "Please enter the homework:" << endl;
    getline(cin, HW);
    CLSS();

    ofstream myfile;
    myfile.open(CTS(HWS+".txt"));
    myfile << HW;
    myfile.close();

    cout << "You have saved the information to a file! :D" << endl;

    string SEL;
    bool ASEL=false;
    cout << "Do you wan't to add another entry? yes or no" << endl;
    getline(cin, SEL);
    system("CLS");
    if(SEL=="yes" || SEL=="Yes" || SEL=="YES" || SEL=="Y" || SEL=="y")
        ASEL=true;
    else
        ASEL=false;
    if(ASEL==true)
        goto A;
    return 0;
}

const char* CTS(string strng)
{
    const char* FON;
    FON=strng.c_str();
    return FON;
}
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
void ClSS()
{
系统(“CLS”);
}
常量字符*CTS(字符串);
int main()
{
A:
字符串HWS,HW;//我们将在这个

您可能已经声明了
ClSS()
,但是您正在调用
ClSS())
。后者没有在任何地方声明。

谢谢,我一定花了20多分钟寻找错误,几乎发疯了,我知道了。很简单:P@user2003618区分大小写的搜索非常有用。注意:您的
CTS
函数具有未定义的行为,返回指向本地
std::str的内部缓冲区的指针ing