<i id='s8X4P'><tr id='s8X4P'><dt id='s8X4P'><q id='s8X4P'><span id='s8X4P'><b id='s8X4P'><form id='s8X4P'><ins id='s8X4P'></ins><ul id='s8X4P'></ul><sub id='s8X4P'></sub></form><legend id='s8X4P'></legend><bdo id='s8X4P'><pre id='s8X4P'><center id='s8X4P'></center></pre></bdo></b><th id='s8X4P'></th></span></q></dt></tr></i><div id='s8X4P'><tfoot id='s8X4P'></tfoot><dl id='s8X4P'><fieldset id='s8X4P'></fieldset></dl></div>
    1. <tfoot id='s8X4P'></tfoot>

      <small id='s8X4P'></small><noframes id='s8X4P'>

    2. <legend id='s8X4P'><style id='s8X4P'><dir id='s8X4P'><q id='s8X4P'></q></dir></style></legend>

      • <bdo id='s8X4P'></bdo><ul id='s8X4P'></ul>

        函数调用时未找到标识符错误

        Identifier not found error on function call(函数调用时未找到标识符错误)

          <legend id='EbH9e'><style id='EbH9e'><dir id='EbH9e'><q id='EbH9e'></q></dir></style></legend>
            <tbody id='EbH9e'></tbody>
        • <small id='EbH9e'></small><noframes id='EbH9e'>

          <tfoot id='EbH9e'></tfoot>
        • <i id='EbH9e'><tr id='EbH9e'><dt id='EbH9e'><q id='EbH9e'><span id='EbH9e'><b id='EbH9e'><form id='EbH9e'><ins id='EbH9e'></ins><ul id='EbH9e'></ul><sub id='EbH9e'></sub></form><legend id='EbH9e'></legend><bdo id='EbH9e'><pre id='EbH9e'><center id='EbH9e'></center></pre></bdo></b><th id='EbH9e'></th></span></q></dt></tr></i><div id='EbH9e'><tfoot id='EbH9e'></tfoot><dl id='EbH9e'><fieldset id='EbH9e'></fieldset></dl></div>

              • <bdo id='EbH9e'></bdo><ul id='EbH9e'></ul>
                  本文介绍了函数调用时未找到标识符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在这里有一个程序,可以反转输入字符串的大小写.这是我的 .cpp 文件中的代码,我使用的是 Visual Studio C++ IDE.我不确定头文件中需要什么,或者我是否需要一个来完成这项工作.

                  I have a program here where I invert the case of an entered string. This is the code in my .cpp file and I am using Visual Studio C++ IDE. I am not sure what I need in a header file or if I need one to make this work.

                  我的函数调用 swapCase 出错.由于某种我不确定的原因,Main 没有看到 swapCase.

                  Error with my function call swapCase. Main does not see swapCase for some reason that I'm not sure of.

                  #include <cctype>
                  #include <iostream>
                  #include <conio.h>
                  
                  using namespace std;
                  
                  int main()
                  {
                      char name[30];
                      cout<<"Enter a name: ";
                      cin.getline(name, 30);
                      swapCase(name);
                      cout<<"Changed case is: "<< name <<endl;
                      _getch();
                      return 0;
                  }
                  
                  void swapCase (char* name)
                  {
                      for(int i=0;name[i];i++)
                      {
                          if ( name[i] >= 'A' && name[i] <= 'Z' )
                              name[i] += 32; //changing upper to lower
                          else if( name[i] >= 'a' && name[i] <= 'z')
                              name[i] -= 32; //changing lower to upper
                      }
                  }
                  

                  感谢任何其他有关语法或语义的提示.

                  Any other tips for syntax or semantics is appreciated.

                  推荐答案

                  在main函数前添加这一行:

                  Add this line before main function:

                  void swapCase (char* name);
                  
                  int main()
                  {
                     ...
                     swapCase(name);    // swapCase prototype should be known at this point
                     ...
                  }
                  

                  这称为前向声明:编译器在编译函数调用时需要知道函数原型.

                  This is called forward declaration: compiler needs to know function prototype when function call is compiled.

                  这篇关于函数调用时未找到标识符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is Type(::x); valid?(是类型(::x);有效的?)
                  Difference between an inline function and static inline function(内联函数和静态内联函数的区别)
                  Compilation fails randomly: quot;cannot open program databasequot;(编译随机失败:“无法打开程序数据库)
                  Too many initializers error for a simple array in bcc32(bcc32 中的简单数组的初始值设定项过多错误)
                  No Member named stoi in namespace std(命名空间 std 中没有名为 stoi 的成员)
                  Error using a constexpr as a template parameter within the same class(在同一个类中使用 constexpr 作为模板参数时出错)
                  • <small id='puySU'></small><noframes id='puySU'>

                    <i id='puySU'><tr id='puySU'><dt id='puySU'><q id='puySU'><span id='puySU'><b id='puySU'><form id='puySU'><ins id='puySU'></ins><ul id='puySU'></ul><sub id='puySU'></sub></form><legend id='puySU'></legend><bdo id='puySU'><pre id='puySU'><center id='puySU'></center></pre></bdo></b><th id='puySU'></th></span></q></dt></tr></i><div id='puySU'><tfoot id='puySU'></tfoot><dl id='puySU'><fieldset id='puySU'></fieldset></dl></div>

                          • <bdo id='puySU'></bdo><ul id='puySU'></ul>

                              <tbody id='puySU'></tbody>
                            <tfoot id='puySU'></tfoot><legend id='puySU'><style id='puySU'><dir id='puySU'><q id='puySU'></q></dir></style></legend>