Está en la página 1de 4

#include <stdio.

h>
#include <iostream.h>
#include <conio.h>
#include <math.h>
#define n 2
int menu()
{
int opcion;
clrscr();
gotoxy(10,7);
cout<<" NOTAS";
gotoxy(10,8);
cout<<"SERGIO SULCA SEXTO INFORMATICA";
gotoxy(10,9);
cout<<"1.-Ingreso de datos";
gotoxy(10,10);
cout<<"2.-Consulta de estudiantes al supletorio";
gotoxy(10,11);
cout<<"3.-Consulta de estudiantes perdidos el año";
gotoxy(10,12);
cout<<"4.-Consulta de estudiantes que pasan el año";
gotoxy(10,14);
cout<<"5.-Salir";
gotoxy(10,14);
cin>>opcion;
return opcion;
}

void dibujarlinea(int a,int b, int c, int d, int e, int f, int g, int h)


{
int i,j;
for (i=a;i<=b;i++)
{
gotoxy(i,c);
cout<<"_";
gotoxy(i,d);
cout<<"_";
}
for (j=e;j<=f;j++)
{
gotoxy(g,j);
cout<<"¦";
gotoxy(h,j);
cout<<"¦";
}
}
struct agenda
{
int codigo;
char nombre[25];
char telefono[10];
char materia[25];
int curso;
int edad;
int n1;
int n2;
int n3;
};
struct agenda a[n];

void datos()
{
clrscr();
for(int i=0;i<n;i++)
{
cout<<"Ingrese codigo: ";
cin>>a[i].codigo;
cout<<"Ingrese nombre: ";
cin>>a[i].nombre;
cout<<"Ingrese edad: ";
cin>>a[i].edad;
cout<<"Ingresar telefono: ";
cin>>a[i].telefono;
cout<<"Ingrese materia: ";
cin>>a[i].materia;
cout<<"Curso: ";
cin>>a[i].curso;
cout<<"Ingrese nota 1: ";
cin>>a[i].n1;
cout<<"Ingrese nota 2: ";
cin>>a[i].n2;
cout<<"Ingrese nota 3: ";
cin>>a[i].n3;
}
}
void leer()
{
for(int j=0;j<n;j++)
{
cout<<"Su codigo es "<<a[j].codigo<<endl;
cout<<"Su nombre es "<<a[j].nombre<<endl;
cout<<"Su edad es "<<a[j].edad<<endl;
cout<<"Su telefono es "<<a[j].telefono<<endl;
cout<<"Materia: "<<a[j].materia<<endl;
cout<<"Curso: "<<a[j].curso<<endl;
cout<<"La nota 1 es : "<<a[j].n1<<endl;
cout<<"La nota 2 es : "<<a[j].n2<<endl;
cout<<"La nota 3 es : "<<a[j].n3<<endl;
cout<<"******************************"<<endl;
}
}
void perdidos()
{
int x,y,z,s,p;
clrscr();
for(int j=0;j<n;j++)
{
x=a[j].n1;
y=a[j].n2;
z=a[j].n3;
s=x+y+z;
p= s/3;
if (s<25)
{
cout<<"Nombre:"<<a[j].nombre<<endl;
cout<<"PERDIDO EL AÑO, su suma total es:"<<s<<endl;
cout<<"Su promedio es:"<<p<<endl;
cout<<"_________________________________"<<endl;
}
}
getch();
}
void supletorios()
{
int x,y,z, s, p;
clrscr();
for(int j=0;j<n;j++)
{
x=a[j].n1;
y=a[j].n2;
z=a[j].n3;
s=x+y+z;
p= s/3;
if (s>25 && s<40)
{
cout<<"Nombre:"<<a[j].nombre<<endl;
cout<<"SUPLETORIO, su suma total es:"<<s<<endl;
cout<<"Su promedio es:"<<p<<endl;
cout<<"_________________________________"<<endl;
}
}
getch();
}

void pasan()
{
int x,y,z, s, p;
clrscr();
for(int j=0;j<n;j++)
{
x=a[j].n1;
y=a[j].n2;
z=a[j].n3;
s=x+y+z;
p= s/3;
if (s>40)
{
cout<<"Nombre:"<<a[j].nombre<<endl;
cout<<"SUPLETORIO, su suma total es:"<<s<<endl;
cout<<"Su promedio es:"<<p<<endl;
cout<<"_________________________________"<<endl;
}
}
getch();
}

void main()
{
int op=0;
//int r;
dibujarlinea(6,59,1,20,2,20,5,60);
while(op!=5)
{
op=menu();
switch (op){
case 1: datos(); break;
case 2: supletorios();break;
case 3: perdidos(); break;
case 4: pasan(); break;
}
}
}

También podría gustarte