Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/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++ Grade程序语法问题_C++ - Fatal编程技术网

C++ Grade程序语法问题

C++ Grade程序语法问题,c++,C++,大家晚上好,在尝试写我的班级成绩代码时,我似乎遇到了一些错误。。。也就是说,&&后面的运算符给出了错误(应该是一个表达式),而else语句给出了一个错误,表示没有if语句。有人愿意帮忙吗 #include <iostream> using namespace std; int main() { double point; cout << "Enter your grade point." << endl; cin >> p

大家晚上好,在尝试写我的班级成绩代码时,我似乎遇到了一些错误。。。也就是说,&&后面的运算符给出了错误(应该是一个表达式),而else语句给出了一个错误,表示没有if语句。有人愿意帮忙吗

#include <iostream>
using namespace std;
int main()
{
    double point;

    cout << "Enter your grade point." << endl;
    cin >> point;

    if (point <= 100 && >= 90) {
        cout << "Congratulations! You got an A" << endl;
    }
    else if (point >= 80 && < 90) {
        cout << "Good Job, you got a B" << endl;
    }
    else if (point >= 70 && < 80) {
        cout << "You got a C, at least it counts." << endl;
    }
    else if (point >= 60 && < 70)
    {
        cout << "You got a D... should have tried harder" << endl;
    }
    else if (point >= 0 && < 60)
    {
        cout << "You got an E. What happened?!?" << endl;
    }
    else if (point < 0 || >100)
    {
        cout << "Invalid input" << endl;
    }





    system("pause");
    return 0;
}
#包括
使用名称空间std;
int main()
{
双点;
cout点;
如果(点=90){

cout因为我已经解释了评论中的错误,所以我想写一个完整的答案并附加提示可能会有所帮助


再看看你的问题:表达式
if(point=90)
是不正确的,因为
if
语句需要一个
bool
表达式。逻辑运算符
&&
确定左右
bool
表达式是否为
true
,如果两个表达式都为true,则返回该值。请注意刚读到的内容。两个表达式都表示re需要两个表达式。第一个表达式是
point=90
。这不是一个有效的表达式,因为您需要提供一个独立的表达式。您可能想到的是检查if 100
if(point=90)
是错误的。
&&
需要两个布尔表达式,而
=90
不是一个表达式。您需要的是
if(point=90)
。将此逻辑应用于所有情况将导致堆栈溢出!为了帮助人们回答您的问题,您需要更具体地说明错误。请在您的帖子中包含您从您的应用程序中获得的确切错误(最好使用复制+粘贴以避免转录错误)。在发布邮件时,注意不要花费太多时间纠正人们不相关的事情。本示例的目的是为了说明问题。当文体捷径使核心问题更加清晰,并消除那些会分散注意力的事情时,通常会有助于此。