Hola me podrian ayudar porfvor, necesito hacer una estructura de 3 alumnos que contega en la estructura el nombre y una nota, luego debo imprimir que estudiante tiene la mayor nota con su nombre porfavor ayudenme!!!
Saludos,
- Revísate una buena guía, por ejemplo: https://openlibra.com/es/book/fundamentos-de-la-programacion (página 288)
- Luego ayúdate de lo siguiente y termina tu ejercicio, si tienes alguna duda o problema muestra tu avance indicando el problema concreto:
#include <iostream>
using namespace std;
struct Alumno {
string nombre;
int nota;
};
int main() {
Alumno a1, a2;
a1.nombre = "Pepe";
a1.nota = 15;
a2.nombre = "Paco";
a2.nota = 19;
if (a1.nota > a2.nota) {
cout << a1.nombre << " tiene una mayor nota (" << a1.nota << ")" << endl;
} else {
cout << a2.nombre << " tiene una mayor nota (" << a2.nota << ")" << endl;
}
return 0;
}
- Más buenos e-books en español y desde cero:
https://openlibra.com/es/book/aprenda-c-como-si-estuviera-en-primero
https://openlibra.com/es/book/fundamentos-de-programacion-con-el-lenguaje-de-programacion-c-ed-2017
https://openlibra.com/es/book/download/fundamentos-basicos-de-programacion-en-c
https://openlibra.com/es/book/pensar-en-c-plus-plus
https://openlibra.com/es/book/resolviendo-problemas-con-el-lenguaje-de-programacion-c