expected unqualified-id before ‘float’

0

Uczę się dopiero programować w C++, i nie wiem gdzie mam tu błąd: float oceny [5]; float suma, float srednia; .
Mam komunikat że jest tam błąd związany z float, ale nie wiem gdzie, bo wszystko wygląda dobrze. Próbowałem z różnymi bibliotekami, ale nic to nie zmienia.
Tutaj podaje całość kodu+

#include <iostream>

using namespace std;
float oceny[5];
float suma, float srednia;
int main()
{
    for (int i = 0; i < 5; i++) {
        cout << "podaj " << i + 1 << " ocene:" << endl;
        cin >> oceny[i];
        suma = suma + suma[i];
        cout << endl
             << "suma=" << suma;
    }
    cout << endl
         << "suma=" << suma;
    return 0;
}

Z góry dziękuje za pomoc.

5

Nie wiesz gdzie masz błąd a masz napisane:

test.cpp:4:30: error: expected unqualified-id before ‘float’
    4 | float oceny [5]; float suma, float srednia;

albo:

float suma, srednia;

albo:

float suma; float srednia;

A potem jeszcze jakieś herezje tutaj:

test.cpp:11:17: error: invalid types ‘float[int]’ for array subscript
   11 | suma=suma+suma[i];

1 użytkowników online, w tym zalogowanych: 0, gości: 1