HELP [error] expected unqualified-id before '{' token
#include <iostream> using namespace std; int minimum (double grades [], int N) { double ans = 101; for ( int i = 0; i< N; i++) if (grades [i] < ans) ans = grades [i]; return ans; } int maximum (double grades [], int N) { double ans = -1; for (int i=0 ; i<N ; i++) if (grades [i] > ans) ans = grades [i]; return ans; } { double min_value; int min_index; double temp; for (int i =0; i<npts -1 ; i++) { min_value = x[i]; min_index = i; for (int j=i+1; j<npts; j++) { if (x[j] < min_value) { min_value = x[j]; min_index = j; } } temp = x[min_index]; x[min_index]= x[i]; x[i] = temp; } return; } int main () { int N; double grades [100]; cout << "Enter the number of students" << endl; cin >> N; int i = 0; double value; while (i<N) { com >> value; if (value >= 0 && value <=100) { grades [i] = value; i++; } else { cout << "Invalid grade. ReEnter" <<endl; } } cout <<"Maximum grade is = "<< maximum (grades,N) <<endl; cout << "Minimum grade is= " << minimum (grades,N) <<endl; cout << "Avergage grade is= "<< average (grades,N) <<endl; cout << "Numbers of the students above average are = " << nAboveAvg (grades,N) <<endl; sort (grades,N); cout << "Grades after sorting"<< endl; for (int i=0; i<n; i++) cout << grades[i] << " "; cout<< endl; system ("pause"); }
Что я уже пробовал:
Когда я компилирую это, он показывает мне
[error] expected unqualified-id before '{' token
в строке 26, где я выделил вот так >> <. Пожалуйста, помогите мне
int maximum (double grades [], int N) { double ans = -1; for (int i=0 ; i<N ; i++) if (grades [i] > ans) ans = grades [i]; return ans; } >> { << double min_value; int min_index; double temp; for (int i =0; i<npts -1 ; i++)
Patrice T
удалить предыдущий вопрос
Member 13754010
Я сделал