Enunciado:"Realizar un programa en el que se tenga como entrada: nombre, edad y 3 notas del estudiante con un menú en el que se pueda:1 - Ingresar los datos de los estudiantes.2 - Buscar datos del estudiante mediante su nombre.3 - Informe de datos de los estudiantes ordenado por su nota de menor a mayor y mostrando si ha aprobado o reprobado.4- Cantidad de estudiantes aprobados, reprobados y promedio de notas de la seccion.Además guardar el informe y la cantidad de estudiantes aprobados y reprobados junto al promedio de notas en un archivo txt."
Clases:Estudiante.h#ifndef ESTUDIANTE_H_#define ESTUDIANTE_H_#include iostream#include string.husing namespace std;class Estudiante {private: string nombre; int edad; float nota1; float nota2; float nota3;public: Estudiante(); void setnombre(string nom); string getnombre(); void setedad(int eda); int getedad(); float getNota1(); void setNota1(float not1); float getNota2(); void setNota2(float not2); float getNota3(); void setNota3(float not3); float Calnotaf(); string CalApRp();};#endif /* ESTUDIANTE_H_ */
#include "Estudiante.h"Estudiante::Estudiante() { // TODO Auto-generated constructor stub nombre = ""; edad = 0; nota1 = 0; nota2 = 0; nota3 = 0;}void Estudiante::setnombre(string nom){ nombre = nom;}string Estudiante::getnombre(){ return nombre;}void Estudiante::setedad(int eda){ edad = eda;}int Estudiante::getedad(){ return edad;}float Estudiante::getNota1() { return nota1;}void Estudiante::setNota1(float not1) { nota1 = not1;}float Estudiante::getNota2() { return nota2;}void Estudiante::setNota2(float not2) { nota2 = not2;}float Estudiante::getNota3() { return nota3;}void Estudiante::setNota3(float not3) { nota3 = not3;}float Estudiante::Calnotaf() { float notaf; notaf = ((nota1 + nota2 + nota3) * 20) /100; return notaf;}string Estudiante::CalApRp() { string ApRp; if(Calnotaf() = 10 && Calnotaf()= 20) ApRp = "Aprobado"; else if(Calnotaf() = 0 && Calnotaf() 10) ApRp = "Reprobado"; else ApRp = "Error al verificar nota"; return ApRp;}
#ifndef SECCION_H_#define SECCION_H_#include "Estudiante.h"const int MAX=3;class Seccion {private: int ptr; Estudiante AEstudiante[MAX];public: Seccion(); int getptr(); void setAEstudiante(Estudiante elEstudiante); Estudiante getAEstudiante(int i); void OrdenarEstudiante(); int Buscar(string nombreB); int Calcantap(); int Calcantrep(); float Calpromnot();};#endif /* SECCION_H_ */
/* * Seccion.cpp * * Created on: 23/02/2013 * Author: Francisco Velásquez */#include "Seccion.h"Seccion::Seccion() { // TODO Auto-generated constructor stub ptr = 0;}int Seccion::getptr(){ return ptr;}void Seccion::setAEstudiante(Estudiante elEstudiante){ AEstudiante[ptr] = elEstudiante; ptr++;}Estudiante Seccion::getAEstudiante(int i){ return AEstudiante[i];}void Seccion::OrdenarEstudiante(){ Estudiante Aux; int i, j; for(i=0; iptr-1; i++){ for (j=i+1; jptr; j++){ if(AEstudiante[i].Calnotaf() AEstudiante[j].Calnotaf()) { Aux = AEstudiante[i]; AEstudiante[i] = AEstudiante[j]; AEstudiante[j] = Aux; } } }}int Seccion::Buscar(string nombreB) { int i=0, enc = -1; while(iptr && enc == -1){ if(AEstudiante[i].getnombre() == nombreB) enc = i; else i++; } return enc;}int Seccion::Calcantap() { int cantap; int contap=0; for(int i=0; i ptr; i++){ if(AEstudiante[i].CalApRp() == "Aprobado") contap++; } cantap = contap; return cantap;}int Seccion::Calcantrep() { int cantrep; int contrep = 0; for(int i=0; i ptr; i++){ if(AEstudiante[i].CalApRp() == "Reprobado") contrep++; } cantrep = contrep; return cantrep;}float Seccion::Calpromnot() { float promnot; float acum=0; for(int i = 0; iptr;i++){ acum = acum + AEstudiante[i].Calnotaf(); } promnot = acum/ptr; return promnot;}
#include "Estudiante.h"#include "Seccion.h"#include stdlib.h#include stdio.h#include fstreamvoid IESeccion(Seccion & laSeccion);void IS(Seccion laSeccion);void IBuscar(Seccion laSeccion);void Menu(Seccion laSeccion);void Msjsalida(Seccion laSeccion);void EstApRepProm(Seccion laSeccion);int main(){ Seccion laSeccion; Menu(laSeccion); Msjsalida(laSeccion); return 0;}void EstApRepProm(Seccion laSeccion){ cout "La cantidad de estudiantes aprobados es de: " laSeccion.Calcantap() endl; cout "La cantidad de estudiantes reprobados es de: " laSeccion.Calcantrep() endl; cout "El promedio de notas es de " laSeccion.Calpromnot() " ptos" endl; ofstream archivo; // objeto de la clase ofstream archivo.open("ARP.txt"); archivo "La cantidad de estudiantes aprobados es de: " laSeccion.Calcantap() endl; archivo "La cantidad de estudiantes reprobados es de: " laSeccion.Calcantrep() endl; archivo "El promedio de notas es de " laSeccion.Calpromnot() " ptos" endl; archivo.close(); system("pausenull");}void Msjsalida(Seccion laSeccion){ cout endl; cout endl; cout endl; cout endl; cout endl; cout endl; cout endl; cout endl; cout endl; cout endl; cout " GRACIAS POR USAR FRANCVES SYSTEM" endl; cout " @francves" endl;}void Menu(Seccion laSeccion){ system("cls"); int variable; cout endl; cout "BIENVENIDO AL MENU DE USUARIO, PORFAVOR INGRESE UNA DE LAS SIGUIENTES OPCIONES" endl; cout "______________________________________________________________________________" endl; cout "1 Ingresar datos (si ya ha ingresado datos anteriormente elija otra opcion)" endl; cout "2 Buscar datos de estudiante a travez de su nombre" endl; cout "3 Informe de estudiantes ordenados por su nota de menor a mayor" endl; cout "4 Cantidad de estudiantes aprobados, reprobados y promedio de notas de la seccion" endl; cout "0 SALIR" endl; cin variable; switch(variable){ case 1: system("cls"); IESeccion(laSeccion); Menu(laSeccion); break; case 2: system("cls"); IBuscar(laSeccion); Menu(laSeccion); break; case 3: system("cls"); IS(laSeccion); Menu(laSeccion); break; case 4: system("cls"); EstApRepProm(laSeccion); Menu(laSeccion); break; case 0: system("cls"); Msjsalida(laSeccion); break; default: cout endl; cout "Porfavor solo ingrese opcion 1 - 2 - 3 - 4 - 0" endl; break; } system("pausenull");}void IEEstudiante(Estudiante & elEstudiante){ string nom; int eda; float not1, not2, not3; cout "Ingrese el Nombre del estudiante" endl; cin nom; elEstudiante.setnombre(nom); cout "Ingrese la edad del estudiante" endl; cin eda; elEstudiante.setedad(eda); cout "Ingrese las 3 notas del estudiante una por una" endl; cin not1; elEstudiante.setNota1(not1); cin not2; elEstudiante.setNota2(not2); cin not3; elEstudiante.setNota3(not3);}void IESeccion(Seccion & laSeccion){ Estudiante elEstudiante; for(int i=0; i MAX; i++){ IEEstudiante(elEstudiante); laSeccion.setAEstudiante(elEstudiante); laSeccion.OrdenarEstudiante(); } cout endl; cout "Se han ingresado todos los datos correctamente " endl; cout "Presione cualquier tecla para ser redirigido al menu nuevamente" endl; system("pausenull");}void IS(Seccion laSeccion){ int i; cout " INFORME ESTUDIANTES DE LA SECCION " endl; cout "__________________________________________________________________________" endl; cout "Nombre Edad Nota Aprobado/Reprobado" endl; for(i=0;iMAX;i++){ cout laSeccion.getAEstudiante(i).getnombre() " " laSeccion.getAEstudiante(i).getedad() " " laSeccion.getAEstudiante(i).Calnotaf() " " laSeccion.getAEstudiante(i).CalApRp() endl; } cout endl; cout "Presione cualquiere tecla para regresar al menu" endl; ofstream archivo; archivo.open("reporte.txt"); archivo " INFORME ESTUDIANTES DE LA SECCION " endl; archivo "__________________________________________________________________________" endl; archivo "Nombre Edad Nota Aprobado/Reprobado" endl; for(i=0;iMAX;i++){ archivo laSeccion.getAEstudiante(i).getnombre() " " laSeccion.getAEstudiante(i).getedad() " " laSeccion.getAEstudiante(i).Calnotaf() " " laSeccion.getAEstudiante(i).CalApRp() endl; } archivo endl; archivo "Presione cualquiere tecla para regresar al menu" endl; system("pausenull");}void IBuscar(Seccion laSeccion){ Seccion OSeccion; Estudiante OEstudiante; string nombreB; int posi; cout "Ingrese el nombre a buscar: " endl; cin nombreB; posi = laSeccion.Buscar(nombreB); if(posi != -1){ cout "El nombre existe en la posicion: " posi endl; cout "La edad es: " laSeccion.getAEstudiante(posi).getedad() endl; cout "La nota es: " laSeccion.getAEstudiante(posi).Calnotaf() endl; cout "El estudiante ha " laSeccion.getAEstudiante(posi).CalApRp() " la materia" endl; } else{ cout "No existen datos del estudiante " nombreB endl;} cout endl; cout "Presione cualquiere tecla para regresar al menu" endl; system("pausenull");}
Asbestos Lawyers sell structured settlement calculator mesothelioma suit Business Voip Solutions Service business software MESOTHELIOMA LAW FIRM Donate Old Cars to Charity Online casino Best Seo company Nunavut Culture Dallas Mesothelioma Attorneys Live casino DUI lawyer Hire php programmers world trade center footage Social media management Psychic for Free Better Conference Calls Social media tools webex costs NUNAVUT CULTURE hughes net business Auto Mobile Shipping Quote Car Accident Lawyers Casino Donate Your Car for Kids philadelphia mesothelioma lawyer Criminal lawyer Email Bulk Service New social media platforms Christmas cards Html email auto insurance yuba city ca los angeles motorcycle accident lawyer car accident lawyers los angeles Casino reviews Best social media platforms Php programmers for hire Donate Car for Tax Credit Mobile casino Mortgage Adviser Computer science classes online Injury Lawyers Car Insurance Quotes Utah Motor Insurance Quotes mesothelioma Donate your car Sacramento DONATE YOUR CAR SACRAMENTO Cheap Car Insurance in Virginia Make money online Australia Cheap auto insurance in VA Criminal Defense Attorneys Florida accident attorney san bernardino Insurance MOTOR REPLACEMENTS alcohol rehab center in florida Hire php developers Massage school Dallas Texas domain yahoo Dwi lawyer yahoo web hosting AUTO ACCIDENT ATTORNEY dallas mesothelioma lawyer workers compensation lawyer los angeles purchase structured settlements WebEx costs how to donate a car in california Donate your car for kids refinance with poor credit Criminal defense lawyer Best criminal lawyer in Arizona register free domains workplace accident attorney onlineclasses HOW TO DONATE A CAR IN CALIFORNIA Photo Christmas cards MET AUTO Seo services WordPress themes for designers CRIMINAL DEFENSE ATTORNEYS FLORIDA Automobile Accident Attorney Hire php developer DONATE YOUR CAR FOR KIDS Donate Cars Illinois student loan consolidation program Bankruptcy lawyer PHD on Counseling Education refinance with bad credit Custom WordPress theme designer Personal Injury Law Firm Criminal lawyer Miami Cheap Car Insurance for Ladies Php programmers Seo companies DONATING USED CARS TO CHARITY World trade center footage Virtual Data Rooms Life insurance co Lincoln Best social media platforms for business Business finance group HARDDRIVE DATA RECOVERY SERVICES NEUSON Social media examiner EMAIL BULK SERVICE Dayton Freight Lines online criminal justice degree ASBESTOS LAWYERS CAR DONATE buyers of structured settlements Social media platforms for business personal injury attorney springfield mo illinois law lemon Car Insurance Quotes PA Cheap car insurance in Virginia LIFE INSURANCE CO LINCOLN Futuristic Architecture Car insurance quotes MN personal accident attorney DONATE CARS IN MA mesothelioma settlements STRUCTURED ANNUITY SETTLEMENT Business management software Adobe illustrator classes mesothelioma attorney directory Seo company Custom Christmas cards Online Christmas cards earthlink business internet Cheap Domain Registration Hosting california mesothelioma attorney AUTOMOBILE ACCIDENT ATTORNEY donate your car for kids meso lawyer Paperport Promotional Code WordPress hosting car insurance in south dakota Psd to WordPress Proud Italian cook Forensics Online Course Tech school World Trade Center Footage harddrive data recovery services Social media platforms phd in counseling education mesothelioma attorney california personal injury attorney torrance Psd to html Italian cooking school WordPress theme designers Social media strategies Donate old cars to charity Learning adobe illustrator Car Insurance Quotes Colorado SELL ANNUITY PAYMENT structured annuity settlement Car Insurance Quotes MN Mesothelioma Law Firm donate your car for money anti spam exchange server Social media campaigns MASSAGE SCHOOL DALLAS TEXAS business voice mail service Online Stock Trading Donate Car to Charity California PAPERPORT PROMOTIONAL CODE primary pulmonary hypertension motorcycle accident attorney chicago Donate Cars in MA mesothelioma help Donate Your Car Sacramento How to Donate A Car in California Car Insurance Quotes Sell Annuity Payment mesothelioma symptoms Structures Annuity Settlement WORLD TRADE CENTER FOOTAGE event management security Paperport promotional code Annuity Settlements att call conference Motor Replacements mesothelioma law firm cheap domain registration hosting personal injury firm Online colledges Forensics online course Donate a Car in Maryland federal criminal defense attorney Hard drive Data Recovery Services domains yahoo best structured settlement companies DONATING A CAR IN MARYLAND Donating a Car in Maryland structured settlement purchasers Cheap Auto Insurance in VA ONLINE COLLEDGES compare life assurance CAR INSURANCE QUOTES MN selling a structured settlement donate old cars to charity Best Criminal Lawyers in Arizona Donate car to charity California Life Insurance Co Lincoln Holland Michigan College Online Motor Insurance Quotes selling my structured settlement CAR INSURANCE QUOTES UTAH Mortgage Online Colleges mortgage adviser structured settlements annuities auto insurance cost by state Car insurance quotes Colorado cell cycle regulation ppt Online Classes asbestos mesothelioma lawsuit Car Insurance Companies Massage School Dallas Texas ROYALTY FREE IMAGES STOCK DONATE CAR FOR TAX CREDIT DONATE YOUR CAR FOR MONEY Low Credit Line Credit Cards structured settlement company Donate your Car for Money Met Auto Home Phone Internet Bundle Donating Used Cars to Charity georgia truck accident lawyer Neuson Royalty Free Images Stock Car Insurance in South Dakota Webex Costs holland michigan college Register Free Domains lawyers accidents Claim Car Donate google adsense personal injury solicitor LOW CREDIT LINE CREDIT CARDS Online College Course Auto Accident Attorney Data Recovery Raid Business VOIP Solutions auto accident attorney hair removal washington dc Personal Injury Lawyers Asbestos Lung Cancer CHEAP CAR INSURANCE FOR LADIES Online Criminal Justice Degree
No hay comentarios:
Publicar un comentario