C++ 获取)函数参数中的预期错误

C++ 获取)函数参数中的预期错误,c++,structure,C++,Structure,我正在试着做一张学生成绩单(大约10名学生) 我得到1个错误,即“error TESTING.CPP 18:)EXPECTED”,请查看代码并帮助我 当我删除这个参数时,我得到了25个错误 我还没学过关于班级或工会的知识 我只知道。所以请不要给出结构之外的解决方案 #include<iostream.h > #include<conio.h > #include<stdio.h > struct subject {

我正在试着做一张学生成绩单(大约10名学生)

我得到1个错误,即“error TESTING.CPP 18:)EXPECTED”,请查看代码并帮助我

当我删除这个参数时,我得到了25个错误

我还没学过关于班级或工会的知识

我只知道。所以请不要给出结构之外的解决方案

#include<iostream.h > 
#include<conio.h > 
#include<stdio.h >
    struct subject
         {
            float phy, chem, maths, CS, eng;
         }ss;

struct student
{
    int rno;
    char name[40];
    char Mname[40];
    char Fname[40];
    subject marks;
};

void grade(student U[].marks)   // THIS BLOCK IS GIVING ERROR
{
    char Gphy, Gch, Gmath, GCS, Ge;
    // For Physics
    if (U.marks.phy >= 91 && U.marks.phy <= 100)
            Gphy = "A1";
    else if (U.marks.phy >= 81 && U.marks.phy <= 90)
            Gphy = "A2";
    else if (U.marks.phy >= 71 && U.marks.phy <= 80)
            Gphy = "B1";
    else if (U.marks.phy >= 61 && U.marks.phy <= 70)
            Gphy = "B2";
    else if (U.marks.phy >= 51 && U.marks.phy <= 60)
            Gphy = "C1";
    else if (U.marks.phy >= 41 && U.marks.phy <= 50)
            Gphy = "C2";
    else if (U.marks.phy >= 33 && U.marks.phy < 490)
            Gphy = "D";
    else if (U.marks.phy >= 21 && U.marks.phy <= 32)
            Gphy = "E1";
    else
            Gphy = "E2";
    // For Chemistry
    if (U.marks.chem >= 91 && U.marks.chem <= 100)
            Gchem = "A1";
    else if (U.marks.chem >= 81 && U.marks.chem <= 90)
            Gchem = "A2";
    else if (U.marks.chem >= 71 && U.marks.chem <= 80)
            Gchem = "B1";
    else if (U.marks.chem >= 61 && U.marks.chem <= 70)
            Gchem = "B2";
    else if (U.marks.chem >= 51 && U.marks.chem <= 60)
            Gchem = "C1";
    else if (U.marks.chem >= 41 && U.marks.chem <= 50)
            Gchem = "C2";
    else if (U.marks.chem >= 33 && U.marks.chem < 490)
            Gchem = "D";
    else if (U.marks.chem >= 21 && U.marks.chem <= 32)
            Gchem = "E1";
    else
            Gchem = "E2";
        // For Maths
    if (U.marks.math >= 91 && U.marks.math <= 100)
            Gmath = "A1";
    else if (U.marks.math >= 81 && U.marks.math <= 90)
            Gmath = "A2";
    else if (U.marks.math >= 71 && U.marks.math <= 80)
            Gmath = "B1";
    else if (U.marks.math >= 61 && U.marks.math <= 70)
            Gmath = "B2";
    else if (U.marks.math >= 51 && U.marks.math <= 60)
            Gmath = "C1";
    else if (U.marks.math >= 41 && U.marks.math <= 50)
            Gmath = "C2";
    else if (U.marks.math >= 33 && U.marks.math < 490)
            Gmath = "D";
    else if (U.marks.math >= 21 && U.marks.math <= 32)
            Gmath = "E1";
    else 
            Gmath = "E2";
        // For Computers
    if (U.marks.CS >= 91 && U.marks.CS <= 100)
            GCS = "A1";
    else if (U.marks.CS >= 81 && U.marks.CS <= 90)
            GCS = "A2";
    else if (U.marks.CS >= 71 && U.marks.CS <= 80)
            GCS = "B1";
    else if (U.marks.CS >= 61 && U.marks.CS <= 70)
            GCS = "B2";
    else if (U.marks.CS >= 51 && U.marks.CS <= 60)
            GCS = "C1";
    else if (U.marks.CS >= 41 && U.marks.CS <= 50)
            GCS = "C2";
    else if (U.marks.CS >= 33 && U.marks.CS < 490)
            GCS = "D";
    else if (U.marks.CS >= 21 && U.marks.CS <= 32)
            GCS = "E1";
    else
            GCS = "E2";
        // For English
    if (U.marks.eng >= 91 && U.marks.eng <= 100)
            Ge = "A1";
    else if (U.marks.eng >= 81 && U.marks.eng <= 90)
            Ge = "A2";
    else if (U.marks.eng >= 71 && U.marks.eng <= 80)
            Ge = "B1";
    else if (U.marks.eng >= 61 && U.marks.eng <= 70)
            Ge = "B2";
    else if (U.marks.eng >= 51 && U.marks.eng <= 60)
            Ge = "C1";
    else if (U.marks.eng >= 41 && U.marks.eng <= 50)
            Ge = "C2";
    else if (U.marks.eng >= 33 && U.marks.eng < 490)
            Ge = "D";
    else if (U.marks.eng >= 21 && U.marks.eng <= 32)
            Ge = "E1";
    else
            Ge = "E2";
 }

 void input(student A[45]) 
 {
    clrscr();
    int n;
    cout << "Enter number of Students present (max. 45 ) : ";
    cin >> n;
    char t;
    cout << "Student List (enter 0 to terminate)\n ";
    for (int i = 0; i < n; i++) {
            gotoxy(20, 5);
            cout << "====Student Number" << i + 1 << "====\n";
            cout << "Enter Student's name : ";
            gets(A[i].name);
            cout << "Enter Mother's name : ";
            gets(A[i].Mname);
            cout << "Enter Father's name : ";
            gets(A[i].Fname);
            cout << "Enter roll no. of Student :";
            cin >> A[i].rno;
            cout << "Get Ready to enter marks of each subject....\n";
            clrscr();
            gotoxy(20, 5);
            cout << "==== Marks section ====\n";
            gotoxy(20, 7);
            cout << "Physics    : ";
            gotoxy(20, 9);
            cout << "Chemistry  : ";
            gotoxy(20, 11);
            cout << "Maths     : ";
            gotoxy(20, 13);
            cout << "Computers : ";
            gotoxy(20, 15);
            cout << "English   : ";
            gotoxy(31, 7);
            cin >> A[i].marks.phy;
            gotoxy(31, 9);
            cin >> A[i].marks.chem;
            gotoxy(31, 11);
            cin >> A[i].marks.maths;
            gotoxy(31, 13);
            cin >> A[i].marks.CS;
            gotoxy(31, 15);
            cin >> A[i].marks.eng;
            cout << endl;
            cout << "Do you want to enter more? (y/n) : ";
            cin >> t;
            if (t == 'y' || t == 'Y') {
                    clrscr();
                    continue;
            } else if (t == 'n' || t == 'N')
                    break;
            else {
                    cout << "Invalid choice, continuing..\n";
                    continue;
            }
    }
}

void marks(student I[10])
 {
    cout << "Student Details";
    for (int q = 0; q <= 75; q++)
            cout << "=";
    cout << "R.no\tName\tP  C  M  E  CS  %age  Grade\n";
    for (q = 0; q <= 75; q++)
            cout << "=";
    cout << endl;
    for (int i = 0; i < 10; i++) {
            gotoxy(20, 5);
            cout << "====Student " << i << "====\n";
            cout << "Physics   : " << I[i].marks.phy << endl;
            cout << "Chemistry : " << I[i].marks.chem << endl;
            cout << "Maths     : " << I[i].marks.maths << endl;
            cout << "Computers : " << I[i].marks.CS << endl;
            cout << "English   : " << I[i].marks.eng << endl;
    }
    getch();
}

void main() 
{
    int ch = 0;
    while (ch != 4) {
            clrscr();
            student S[10];
            gotoxy(20, 5);
            cout << "Student Report \n";
            gotoxy(20, 7);
            cout << "1. Enter details\n";
            gotoxy(20, 8);
            cout << "2. Display report of a student via roll no.\n";
            gotoxy(20, 9);
            cout << "3. Display report of all students\n";
            gotoxy(20, 10);
            cout << "4. Exit\n";
            gotoxy(20, 11);
            cout << "Enter your choice [1-4] : ";
            cin >> ch;
            switch (ch) {
            case 1:
                    input(S);
                    break;
            case 4:
                    cout << "Exiting...........";
                    break;
            default:
                    cout << "Invalid choice.";
                    break;
            }
            getch();
    }
  }
#包括
#包括
#包括
结构主题
{
物理、化学、数学、计算机科学、英语;
}ss;
结构学生
{
国际rno;
字符名[40];
char-Mname[40];
char-Fname[40];
科目分数;
};
无效分数(学生U[]分)//此块给出错误
{
char Gphy、Gch、Gmath、GCS、Ge;
//物理系
如果(U.marks.phy>=91&&U.marks.phy=81&&U.marks.phy=71&&U.marks.phy=61&&U.marks.phy=51&&U.marks.phy=41&&U.marks.phy=33&&U.marks.phy<490)
Gphy=“D”;
否则,如果(U.marks.phy>=21&&U.marks.phy=91&&U.marks.chem=81&&U.marks.chem=71&&U.marks.chem=61&&U.marks.chem=51&&U.marks.chem=41&&U.marks.chem=33&&U.marks.chem<490)
Gchem=“D”;
否则,如果(U.marks.chem>=21&&U.marks.chem=91&&U.marks.math=81&&U.marks.math=71&&U.marks.math=61&&U.marks.math=51&&U.marks.math=41&&U.marks.math=33&&U.marks.math<490)
Gmath=“D”;
否则,如果(U.marks.math>=21&&U.marks.math=91&&U.marks.CS=81&&U.marks.CS=71&&U.marks.CS=61&&U.marks.CS=51&&U.marks.CS=41&&U.marks.CS=33&&U.marks.CS<490)
GCS=“D”;
否则,如果(U.marks.CS>=21&&U.marks.CS=91&&U.marks.eng=81&&U.marks.eng=71&&U.marks.eng=61&&U.marks.eng=51&&U.marks.eng=41&&U.marks.eng=33&&U.marks.eng<490)
Ge=“D”;
如果(U.marks.eng>=21&&U.marks.eng n;
查尔特;
库特

这不是块,它是函数声明,它给出错误,因为它不是有效的C++。需要声明一个参数及其类型,而这不是你如何做的。你怎么做完全取决于你想要的参数是什么类型,甚至不太清楚。< /P> < P> OK,我修正了错误


void grade(学生U[]分数)void grade(float G)

手工制作a可以让你自己很快发现这个问题。无关:TurboC++已经过时了大约30年。我强烈建议更新你的编译器和学习材料。你为什么要传入
U[]“标记< /代码>,而不是只是代码> U/COD>?为什么你要指定函数参数为<代码>学生U[]?McAs/Cuth>?这是不正确的。<代码>包含< < /代码>——你是另一个不得不使用恐龙Turbo C++编译器的穷学生吗?你的代码与任何现代C++编译器都是不可编译的。我如何传递这个论点,例如:.marks.phy(从void marks()到grade()函数?
void grade(student U[].marks)    // THIS BLOCK IS GIVING ERROR