You are on page 1of 6

#include <conio.

h>
#include <windows.h>
#include <string.h>
#include <iostream.h>
//using namespace std;
// Andres Villarroel 302993
#define cnt_max_string 10
#define cnt_char_ver 'x'
#define cnt_char_hor '-'
#define cnt_char_marco '*'
#define cnt_char_limpiar ' '
#define cnt_col_pant 5
#define cnt_fil_pant 2
#define cnt_col_mat 20
#define cnt_fil_mat 20
#define cnt_vec 20
#define cnt_num_campos 2
float mat_a[10][5];
float andres;
int mv;
float vnc11,vnc111,vnc1111,vnc11111;
float vnc22,vnc222,vnc2222,vnc22222;
int VOPCION;
int VLV;
int Vfilas,Vcolumnas,edad;
float vlc1,vlc2,vlef,vlco;
float acc1,acc2,acef,acco;
float vnc1,vnc2,vnef,vnco,promedio;
int Vcodigo;
int Vbusqueda;
int Vfila_B;
float Vec_c1[5],Vec_c2[5],Vec_ef[5],Vec_co[5];
struct Tpersona{
int codigo;
char nombres[cnt_max_string];
}Vec_per[cnt_vec];
struct Tpersona Mat_per [cnt_fil_mat] [cnt_col_mat];
/*void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
} */
void Linea (char Ptipo,char Pcaracter,int Pfil, int Pcol,int Pfili,int Pcoli)
{
int vsm,vsmi,vsmf;
int vsl,vsli,vslf;
int vsinc;
switch(Ptipo)

{
case 'A':
vsli=(cnt_col_pant-1); vslf=((cnt_max_string*Pcol)+vsli+Pcol);
vsmi=(cnt_fil_pant-1); vsmf=(((cnt_num_campos+1)*Pfil))+1;
vsinc=cnt_max_string+1;
break;
case 'N':
vsli=(cnt_fil_pant-1); vslf=(((cnt_num_campos+1)*Pfil))+1;
vsmi=(cnt_col_pant-1); vsmf=((cnt_max_string*Pcol)+vsmi+Pcol);
vsinc=cnt_num_campos+1;
break;
case 'D':
vsli=Pcoli; vslf=Pcol; vsmi=Pfili; vsmf=Pfil; vsinc=Pcol-Pcoli;
break;
case 'R':
vsli=Pfili; vslf=Pfil; vsmi=Pcoli; vsmf=Pcol; vsinc=Pfil-Pfili;
break;
case 'E':
vsli=Pfili; vslf=Pfil; vsmi=Pcoli; vsmf=Pcol; vsinc=1;
break;
}
for (vsl=vsli;vsl<=vslf;vsl+=vsinc)
{
for (vsm=vsmi;vsm<=vsmf;vsm++)
{
switch(Ptipo)
{
case 'A': gotoxy(vsl,vsm); cout<< Pcaracter; break;
case 'N': gotoxy(vsm,vsl); cout<< Pcaracter; break;
case 'D': gotoxy(vsl,vsm); cout<< Pcaracter; break;
case 'R': gotoxy(vsm,vsl); cout<< Pcaracter; break;
case 'E': gotoxy(vsl,vsm); cout<< Pcaracter; break;
}
}
}
}
void Vector (int Plv, char Popcion)
{
int vsy=0;
for (int vsf = 0 ; vsf < Plv ; vsf++)
{
switch(Popcion)
{
case 'M':
gotoxy(cnt_col_pant,(cnt_fil_pant+vsy+0));cin>> Vec_per[vsf].codigo;
gotoxy(cnt_col_pant,(cnt_fil_pant+vsy+1));cin>> Vec_per[vsf].nombres;
break;
case 'H':
gotoxy(cnt_col_pant,(cnt_fil_pant+vsy+0));cout<< Vec_per[vsf].codigo;
gotoxy(cnt_col_pant,(cnt_fil_pant+vsy+1));cout<< Vec_per[vsf].nombres;
break;
case 'S':
if (Vec_per[vsf].codigo == Vcodigo)
{
Vbusqueda=1;
Vfila_B=vsf;
}
break;
} // fin del switch
vsy+=cnt_num_campos+1;
} // fin del for vsf
}// fin del void vector
void notas(int Plv,int Popcion)
{
int wa;
mv=0;
ma=0;
while (ma!=VLV)
{
for (int vsf = 0 ; vsf < Plv ; vsf++)
{
acc1 = 0;acc2 = 0;acef = 0;acco = 0; promedio = 0;
switch (Popcion)
{int vsn;
case 1:
cout<<"Ingrese numero de notas en CAT 1: ";
cin>> vlc1;
for ( vsn = 0 ; vsn < vlc1 ; vsn++)
{
cout<<"Ingrese calificacion por pregunta: ";
cin>> Vec_c1[vsf];
acc1 = acc1 + Vec_c1[vsf];
vnc1 = (acc1*0.2);
}
break;
case 2:
cout<<"Ingrese numero de notas en CAT 2: ";
cin>> vlc2;
for (vsn = 0 ; vsn < vlc2 ; vsn++)
{
cout<<"Ingrese calificacion por pregunta: ";
cin>> Vec_c2[vsf];
acc2 = acc2 + Vec_c2[vsf];
vnc2 = (acc2*0.25);
}
break;
case 3:
cout<<"Ingrese numero de notas en EX.FINAL: ";
cin>> vlef;
for ( vsn = 0 ; vsn < vlef ; vsn++)
{
cout<<"Ingrese calificacion por pregunta: ";
cin>> Vec_ef[vsf];
acef = acef + Vec_ef[vsf];
vnef = (acef*0.3);
}
break;
case 4:
cout<<"Ingrese numero de notas en CONTROL: ";
cin>> vlco;
for ( vsn = 0 ; vsn < vlco ; vsn++)
{
cout<<"Ingrese calificacion por pregunta: ";
cin>> Vec_co[vsf];
acco = acco + Vec_co[vsf];
vnco = (acco*0.25);
andres=vnco+vnef+vnc2+vnc1;
}
break;

}
}
ma=ma+1;
}// fin del while
}

void matriz (int Plv)


{
for (int vsf = 0 ; vsf < Plv ; vsf++);
{
mat_a[vsf][0]=vnco;
mat_a[vsf][1]=vnef;
mat_a[vsf][2]=vnc2;
mat_a[vsf][3]=vnc1;
}
}
void menu()
{
//system("cls");
clrscr();
int vsbandera;
vsbandera=1;
while (vsbandera!=0)
{
// system("cls");
clrscr();
//Linea ('L',cnt_char_limpiar,24,79,0,0);
Linea ('X',cnt_char_marco,23,79,0,0);
Linea ('Y',cnt_char_marco, 23, 79,0,0);
gotoxy(5,5);
cout<< " Programa para el calculo de notas por estudiante ";
gotoxy(5,6);
cout<< "**************************************************************\n
";
gotoxy(5,9); cout<< "1: Ingreso numero de estudiantes ";
gotoxy(5,10);cout<< "2: Reporte de VECTOR DE (N) ";
gotoxy(5,11);cout<< "3: Ingreso de notas ";
gotoxy(5,12);cout<< "4: Calculo de notas ";
gotoxy(5,13);cout<< " DIGITE 0 PARA SALIR ";
gotoxy(5,14);
cout<< "**************************************************************";
gotoxy(5,15);cout<<"Opcion: < >";
gotoxy(14,15);cin>> VOPCION;
switch (VOPCION)
{
case 1:
//system("cls");
clrscr();
Linea ('X',cnt_char_marco,25,79,0,0);
Linea ('Y',cnt_char_marco, 25, 79,0,0);
Linea ('X',cnt_char_marco,cnt_fil_pant+3,40,cnt_fil_pant-1,cnt_c
ol_pant-1);
Linea ('Y',cnt_char_marco, cnt_fil_pant+3, 40,cnt_fil_pant-1,cnt
_col_pant-1);
gotoxy(cnt_col_pant,cnt_fil_pant);
cout<< "Ingreso de datos en un Vector ";
gotoxy(cnt_col_pant,cnt_fil_pant+1);
cout<< "Ingrese numero de estudiantes: ";
cin>>VLV;
//system("cls");
clrscr();
Linea ('V',cnt_char_ver, VLV,1,0,0);
Linea ('H',cnt_char_hor, VLV,1,0,0);
Vector (VLV,'I');
break;
case 2:
//system("cls");
clrscr();
Linea ('V',cnt_char_ver, VLV,1,0,0);
Linea ('H',cnt_char_hor, VLV,1,0,0);
Vector (VLV,'P');
gotoxy(10,10);
cout<< vnc11;
gotoxy(10,11);
cout<< vnc22;
gotoxy(10,12);
cout<< vnef;
gotoxy(10,13);
cout<< vnco;
gotoxy(10,14);
cout<<"elpromedio es:";
gotoxy(10,15);
cout<< andres;
gotoxy(5,10);
cout<< vnc1;
gotoxy(5,11);
cout<< vnc2;
gotoxy(5,12);
cout<< vnef;
gotoxy(5,13);
cout<< vnco;
gotoxy(5,14);
cout<<"elpromedio es:";
gotoxy(5,15);
cout<< andres;
getche();
break;
case 3:
//system("cls");
clrscr();
gotoxy(cnt_col_pant,cnt_fil_pant);
notas(VLV,1);
clrscr();
gotoxy(cnt_col_pant,cnt_fil_pant);
notas(VLV,2);
clrscr();
gotoxy(cnt_col_pant,cnt_fil_pant);
notas(VLV,3);
clrscr();
gotoxy(cnt_col_pant,cnt_fil_pant);
notas(VLV,4);
getche();
break;
case 4:
clrscr();
Linea ('V',cnt_char_ver, Vfilas, Vcolumnas,0,0);
Linea ('H',cnt_char_hor, Vfilas, Vcolumnas,0,0);
cout<< mat_a[0][0];
cout<< mat_a[1][1];
cout<< mat_a[2][2];
while (getche() != '\n');
getche();
break;

case 0:
cout<<"\n";
cout<< "\nPulse cualquier tecla para continuar";
getche();
vsbandera=0;
}
}
}
void main(void)
{ menu(); }

You might also like