Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.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++ C+;中我的简单代码块出现2个错误+;文件错误C2059:语法错误:'';。第二智能感知:应为表达式。怎么了? #包括 #包括 使用名称空间std; int main(){ int passs;//传递的类的数量 int fails;//失败的类的数量 双等级;//要分析的当前等级 //初始化通过次数并失败 通过率=0; 失败=0; //一年级提示 cout_C++ - Fatal编程技术网

C++ C+;中我的简单代码块出现2个错误+;文件错误C2059:语法错误:'';。第二智能感知:应为表达式。怎么了? #包括 #包括 使用名称空间std; int main(){ int passs;//传递的类的数量 int fails;//失败的类的数量 双等级;//要分析的当前等级 //初始化通过次数并失败 通过率=0; 失败=0; //一年级提示 cout

C++ C+;中我的简单代码块出现2个错误+;文件错误C2059:语法错误:'';。第二智能感知:应为表达式。怎么了? #包括 #包括 使用名称空间std; int main(){ int passs;//传递的类的数量 int fails;//失败的类的数量 双等级;//要分析的当前等级 //初始化通过次数并失败 通过率=0; 失败=0; //一年级提示 cout,c++,C++,我不是100%确定您在cout行中尝试实现了什么,它看起来很奇怪。无论如何,请尝试用引号(“)包装您希望打印的字符串。在cout之后,您应该向cout提供一些参数,您没有名为“?”的变量,这是参数/字符串应该位于的位置,这是编译器在打印收到的错误时指向的。 我建议在打印字符串的末尾打印“std::endl”或“\n”,以便cin位于不同的行中 这就是它应该看起来的样子 #include <iostream> #include <string> using namesp

我不是100%确定您在cout行中尝试实现了什么,它看起来很奇怪。无论如何,请尝试用引号(“)包装您希望打印的字符串。在cout之后,您应该向cout提供一些参数,您没有名为“?”的变量,这是参数/字符串应该位于的位置,这是编译器在打印收到的错误时指向的。 我建议在打印字符串的末尾打印“std::endl”或“\n”,以便cin位于不同的行中

这就是它应该看起来的样子

#include <iostream>
#include <string>

 using namespace std;

 int main() {
     int passes; //The number of passed classes 
     int fails; // The number of failed classes
     double grade; //The current grade to be analyzed 

     //Initialize number of passes and fails 
     passes = 0;
     fails = 0; 

     //Prompt for first grade 
     cout <<?Please enter a numeric grade(> 0) : ? :
         cin >> grade;
     return 0;

 }
#包括
int main(){
int passs;//传递的类的数量
int fails;//失败的类的数量
双等级;//要分析的当前等级
//初始化通过次数并失败
通过率=0;
失败=0;
//一年级提示
标准:cout等级;

STD::请在实际问题体中提问,告诉我们你在哪里得到的错误。那些<代码> <代码> >代码>:<代码>是什么意思?你想猜C++语法吗?那不管用。然后“像青少年一样编程”。“-我认为标题可能暗示这可能不是有史以来最好的学习资源。我的书中的代码一定过时了。语法不同
#include <iostream>
int main() {
    int passes; //The number of passed classes 
    int fails; // The number of failed classes
    double grade; //The current grade to be analyzed 

    //Initialize number of passes and fails 
    passes = 0;
    fails = 0;

    //Prompt for first grade 
    std::cout << " Please enter a numeric grade(> 0)" << std::endl;
    std::cin >> grade;
    std::cout << "Received grade is " << grade << std::endl;
    return 0;
}