我是初学者,我不能理解我的C++程序中的下列错误

我是初学者,我不能理解我的C++程序中的下列错误,c++,C++,我尤其不明白第一个错误。为什么我会想要一个;在int?之前;int,并且在任何情况下都有一个;在前面一行的int前面。对不起,如果我没有正确地寻求帮助。尽我所能,谢谢 1>c:\users\seven\source\repos\project2\project2\source.cpp(9): error C2144: syntax error: 'int' should be preceded by ';' 1>c:\users\seven\source\repos\project

我尤其不明白第一个错误。为什么我会想要一个;在int?之前;int,并且在任何情况下都有一个;在前面一行的int前面。对不起,如果我没有正确地寻求帮助。尽我所能,谢谢

1>c:\users\seven\source\repos\project2\project2\source.cpp(9): error C2144: syntax error: 'int' should be preceded by ';'

1>c:\users\seven\source\repos\project2\project2\source.cpp(9): error C2270: 'main': modifiers not allowed on nonmember functions

1>c:\users\seven\source\repos\project2\project2\source.cpp(14): error C2062: type 'int' unexpected

请检查语法。所有错误都是由语法错误引起的。

上述错误。您确定这就是您正在编译的代码吗?不过,在我看来,还有很多其他的错误。这些错误消息似乎与您发布的源代码不匹配。看起来您发布的源代码版本与用于生成这些错误消息的源代码版本不同。你应该在回答任何问题之前解决这个问题。您是否在编辑器中更改了源文件,但在编译之前未保存?这就是您看到的源代码可能与正在编译的源代码不同的原因之一。请注意,cout上缺少分号,不应在cout中串联
1>c:\users\seven\source\repos\project2\project2\source.cpp(9): error C2144: syntax error: 'int' should be preceded by ';'

1>c:\users\seven\source\repos\project2\project2\source.cpp(9): error C2270: 'main': modifiers not allowed on nonmember functions

1>c:\users\seven\source\repos\project2\project2\source.cpp(14): error C2062: type 'int' unexpected
#include <iostream>

using namespace std;

int main()
{
int g1, g2, g3, g4; //Numeric grades to be averaged.

cout << "This program averages 4 grades. \n"; // Gathers number inputs to output GPA (Grade Point Average)
cout << "Enter first grade \n";
cin >> g1;
cout << "Enter second grade \n";
cin >> g2;
cout << "Enter third grade \n";
cin >> g3;
cout << "Enter fourth grade \n";
cin >> g4;
cout << "Your average is: \n";

const int gpa = ((g1 + g2 + g3 + g4) / 4.0); // Average of g1, g2, g3, and g4.
const string rep = "Your GPA letter grade is: \n"; // Placeholder for the letter grade reply string.

cout << gpa;

cout << gpa; // Outputs letter grade string
if (gpa >= 90) {
    cout << rep << "A";
}else if (gpa >= 80){
    cout << rep << "B";
}else if (gpa >= 70){
    cout << rep << "C";
}else if (gpa >= 60){
    cout << rep << "D";
}else if (gpa >= 0){
    cout << rep << "F";
}else{ 
    cout  << "Invalid grade entered, enter positive digits only. \n";
}
system("pause");
return 0;
}