Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.5 kB
3
Indexable
Never
#include <iostream>
using namespace std;
int Vector[10], VectorAp[10], VectorDp[10], i_ap = 0, i_dp = 0;
void AgregarElemento(int n, int vector[], int indice) {
    vector[indice] = n;
}

void Informacion(int vector[]) {
    cout << "Ingrese Informacion de Notas al Vector" << endl;
    for (int i = 0; i < 10; i++)
    {
        cout << "Vector[" << i << "]: "; cin >> vector[i];
        while (vector[i] < 0 || vector[i] > 20) {
            cout << "Vector[" << i << "]: "; cin >> vector[i];
        }
    }
}
void MostrarElementos(int n, int vector[]) {

    for (int i = 0; i < n; i++)
    {
        if (!(vector[i]==0))
        {
            cout << "[" << i << "] = " << vector[i] << endl;
        }
         
    }

}
void Resultados(int vector[], int vectorap[], int vectordp[], int iap, int idp)
{
    for (int i = 0; i < 10; i++)
    {
        if (vector[i] > 10)
            AgregarElemento(vector[i], vectorap, iap); iap++;
        if (vector[i] <= 10)
            AgregarElemento(vector[i], vectordp, idp); idp++;   
    }
    cout << "Listado de las Notas Aprobadas" << endl;
    MostrarElementos(iap, vectorap);
    cout << "Listado de las Notas DesAprobadas" << endl;
    MostrarElementos(idp, vectordp);
}

int main()
{
   
    Informacion(Vector);
    cout << "Listado de la Informacion de Notas" << endl;
    MostrarElementos(10, Vector);
    Resultados(Vector, VectorAp, VectorDp, i_ap, i_dp);

    return 0;
}