Write a program to record 3 grades of 5 students with the following information :
Roll No, Name, Exam1,Exam2,Exam3,Average,Approved(YES/NO).
The program must have a menu where:
1) Students and grades are recorded
2) Search student ( show students name and Roll No)
3) Delete student
4) Show averages ( show student name and his average )
5 ) Show approved students ( only show students that have approved, the minimum average is : 70)
------------------------------------------------------------
I WOULD LIKE HELP WITH 2) AND 3)
------------------------------------------------------------
I have done this modifying programs that we have done from previous classes.
P.S. Sorry if my english is bad.
EDIT: Not sure, but i think the correct word instead of Roll no would be enrollment number.
---------------------------------------------------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
string Alumnos[5];
string NoCont[5];
float datos[5][3];
char pal[20];
float n;
float totales[3];
float promedio[3];
// This function is for getting student's Roll No
void NoControl() {
cout << "HAZ SELECCIONADO LA OPCION PARA REGISTRAR EL NO. CONTROL" << endl;
cin.ignore();
for(int i = 0; i < 5; i++){
cout << "Ingresa el No. de Control del Alumno No. " << (i+1) << endl;
cin.getline(pal, 20);
NoCont[i] = pal;}}
// This function is for getting student's Name
void pedirAlumno(){
cout << "HAZ SELECCIONADO LA OPCION PARA REGISTRAR A LOS ALUMNOS Y SUS CALIFICACIONES" << endl;
cin.ignore();
for(int i = 0; i < 5; i++){
cout << "Ingresa el nombre del Alumno No. " << (i+1) << endl;
cin.getline(pal, 20);
Alumnos[i] = pal;}
for(int f=0;f<5;f++){
for(int c=0;c<3;c++){
cout<<"Escriba las calificaciones de: "<< Alumnos[f]<<" : ";
cin>> n;
datos[f][c]=n;
totales[f]= totales[f]+datos[f][c]/3;
}}}
//This one prints students name
//I think that i will need this and the next one for 2) Search student (?)
void imprimAlum(){
cout << "ALUMNOS REGISTRADOS " << endl;
for(int i = 0; i < 5; i++){
cout << "El alumno No. " << (i+1) << " es: " << Alumnos[i] << endl;
}}
//This one should print student Roll No
void imprimNoCont(){
cout << "NUMEROS DE CONTROL " << endl;
for(int i = 0; i < 5; i++){
cout << "El numero de control " << (i+1) << " es: " << Alumnos[i] << endl;
}}
// This function is for printing the students name, grades and his average
void imprimeCalif(){
for(int f=0;f<5;f++){
cout<<Alumnos[f]<<" ";
for(int c=0;c<3;c++){
cout<<datos[f][c]<<" ";
}cout<<totales[f]<<endl;
cout<<endl;
}}
void Menu(){
int op = 0;
do{
cout << "-------- MENU PRINCIPAL ----------" << endl;
cout << "[1] REGISTRAR EL NUMERO DE CONTROL " << endl;
cout << "[2] REGISTRAR A LOS ALUMNOS Y SUS CALIFICACIONES" << endl;
cout << "[3] MOSTRAR PROMEDIOS" << endl;
cout << "[-1] Salir del programa." << endl;
cin >> op;
switch(op){
case -1:
cout << "Cerraras el programa... estas seguro? [1] SI [2] NO" << endl;
cin >> op;
if(op == 1) op = -1;
else op = 0;
break;
case 1:
NoControl();
break;
case 2:
pedirAlumno();
break;
case 3:
imprimeCalif();
break;
default:
cout << "!!! Ingresa una opcion valida !!!" << endl;
}
}while(op != -1);
}
int main(int argc, char** argv) {
Menu();
return 0;
}
|