#include <iostream>
#include <vector>
using namespace std;
vector<float> nota_final(vector<vector<float>> notas);
void aprobados_reprobados(vector<float> notas);
void calcular_faltante(vector<float> notas, vector<float> repetidos);
int main() {
vector<vector<float>> notas {
{12.4, 11.6, 17.0},
{16.4, 19.6, 11.0},
{9.4, 12.6, 15.0},
{10.4, 16.6, 19.0},
{17.4, 5.6, 20.0}
};
vector<float> notas_final = nota_final(notas);
aprobados_reprobados(notas_final);
return 0;
}
vector<float> nota_final(vector<vector<float>> notas) {
vector<float> notas_final;
for (int i = 0; i < notas.size(); i++) {
float grupal = notas[i][0] * 0.25;
float individual = notas[i][1] * 0.35;
float examen = notas[i][2] * 0.4;
notas_final.push_back(grupal + individual + examen);
}
cout << "1. Notas finales: [ ";
for (int i = 0; i < notas_final.size(); i++) {
cout << notas_final[i] << " ";
}
cout << "]" << std::endl;
return notas_final;
}
void aprobados_reprobados(vector<float> notas) {
vector<float> aprobados, reprobados;
for (int i = 0; i < notas.size(); i++) {
if (notas[i] >= 14.0) {
aprobados.push_back(notas[i]);
} else {
reprobados.push_back(notas[i]);
}
}
cout << "\n2. Aprobados - Reprobados" << endl;
cout << "Aprobados: [ ";
for (int i = 0; i < aprobados.size(); i++) {
cout << aprobados[i] << " ";
}
cout << "] - Total: " << aprobados.size() << std::endl;
cout << "Reprobados: [ ";
for (int i = 0; i < reprobados.size(); i++) {
cout << reprobados[i] << " ";
}
cout << "] - Total: " << reprobados.size() << std::endl;
calcular_faltante(notas, reprobados);
}
void calcular_faltante(vector<float> notas, vector<float> reprobados) {
vector<float> faltante;
for (int i = 0; i < reprobados.size(); i++) {
faltante.push_back(14 + (14 - reprobados[i]));
}
cout << "\n3. Nota Objetivo: [ ";
for (int i = 0; i < faltante.size(); i++) {
cout << faltante[i] << " ";
}
cout << "] " << std::endl;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: