Fandom

Scratchpad

PLE:Unidad4Ejercicio06

219,314pages on
this wiki
Add New Page
Discuss this page0 Share
/*
Programa:         Unidad4Ejercicio06.cpp
Fecha:            24/11/2006
Descripción:      Programa quinielistico.

*/
#include <iostream>
#include <conio>
#include <stdlib>
#include <ctype>
using namespace std;

const int NUMASIG=5;
const int NUMALUM=30;

void main()
{
        float notas[NUMASIG+1][NUMALUM+1], media;
        int i,j;

        for(i = 0; i < NUMASIG; i++)
        {
                cout << "Notas de la asignatura " << i << endl;
                for(j = 0; j < NUMALUM; j++)
                {
                        cout << "Alumno " << j << " ";
                        cin >> notas[i][j];
                }
        }

        // Calculamos la media por asignatura
        for(i = 0; i < NUMASIG; i++)
        {
                media = 0;
                for(j = 0; j < NUMALUM; j++)
                {
                        media += notas[i][j];
                }
                media /= NUMALUM;
                notas[i][NUMALUM] = media;
        }

        // Calculamos la media por alumno
        for(j = 0; j <= NUMALUM; j++)
        {
                media = 0;
                for(i = 0; i < NUMASIG; i++)
                {
                        media += notas[i][j];
                }
                media /= NUMASIG;
                notas[NUMASIG][j] = media;
        }

        // Mostramos los resultados
        cout << "Notas y medias " << endl;
        for(i = 0; i <= NUMASIG; i++)
        {
                for(j = 0; j <= NUMALUM; j++)
                {
                        cout << notas[i][j] << '\t';
                }
                cout << endl;
        }

        cin.ignore();
        cin.get();
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random wikia