12.algoritmus

 

Prospěch žáka

 

#include <cstdlib>

#include <iostream>

 

using namespace std;

 

int main()

{

    float a,n,s,max,prum;

    cout << "Zjisteni prospechu z n znamek? \n";

    cout << "Kolik bude znamek? ";

    cin >> n;

    for (int i=0; i<n; i++)

    {

        cout << "Zadej znamku: ";

        cin >> a;

        s = s + a;

        if (max<a) max=a;

    }   

    prum=s/n;

    if (max<3&&prum<=1.5) cout << "S vyznamenanim";

       else if (max<5) cout << "Prospel";

       else cout << "Neprospel";

    cout << endl << endl;

    system("PAUSE");

    return 0;

}


Vytvořte si webové stránky zdarma! Webnode