// Zadatak08.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    vector<string> kolegij;
    vector<vector<double>> ocjeneKolegija;
    char ponovi;

    cout << "Unos Predemta" << endl;
    do 
    {
        string naziv;
        cout << "Naziv predmeta: ";
        cin >> naziv;
        kolegij.push_back(naziv);

        cout << "Dodaj jos predmeta (d/n): ";
        cin >> ponovi;
    } while (ponovi=='d');

    system("cls");
    cout << "Unos ocjena" << endl;
    for (int i = 0; i < kolegij.size(); i++)
    {
        cout << endl << kolegij[i] << endl << "-----------" << endl;
        int redniBrojOcjene = 0;
        vector<double> ocjeneZaTrenutniKolegij;
        do 
        {
            double ocjena;
            cout << ++redniBrojOcjene << ". ocjena: ";
            cin >> ocjena;
            ocjeneZaTrenutniKolegij.push_back(ocjena);

            cout << "Dodatri jos ocjena (d/n): ";
            cin >> ponovi;
        } while (ponovi=='d');
        ocjeneKolegija.push_back(ocjeneZaTrenutniKolegij);
    }

    system("cls");
    cout << "ISPIS" << endl;
    for (int i = 0; i < kolegij.size(); i++)
    {
        double suma = 0;
        cout << endl << endl << kolegij[i] << endl << "-------------" << endl;
        for (int j = 0; j < ocjeneKolegija[i].size(); j++)
        {
            suma += ocjeneKolegija[i][j];
            if (j == ocjeneKolegija[i].size() - 1)
                cout << ocjeneKolegija[i][j] << ".";
            else
                cout << ocjeneKolegija[i][j] << ", ";
        }
        cout << endl << "Prosjecna ocjena: " << suma / ocjeneKolegija[i].size() << endl;

    }
    cout << endl;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
