1) Me piden que haga un vector con la cantidad de cada prestamo, luego mostrar por pantalla
2) Que muestre por pantalla, los datos de la gente de misiones que pidieron prestamos personales
3) Que muestre por pantalla, la cantidad de gente de corrientes que pidieron prestamos prendarios.
Muchas gracias desde ya gentes! Espero que no sea tan largo mi codigo
Código
#include<stdio.h> #include<stdlib.h> #include<string.h> void inicializar(); void proceso(); void finalizar(); void mostrarVector(); void condicion(); float porcentaje (int, int); /* Estructura del Registro */ typedef struct { int dniCliente; char apeNom[30]; int codPrestamo; char codProvincia; float prestamo; }tProvencred; tProvencred regProvencred; FILE *f_Provencred; int vPrestamos[5]; int i; int cantTotal; int cantHipotecario; int cantCorr; int main() { inicializar(); proceso(); finalizar(); return 0; } void inicializar() { i = 0; cantHipotecario = 0; cantTotal = 0; cantCorr = 0; } void proceso() { do { cantTotal++; switch(regProvencred.codPrestamo) { case 1: vPrestamos[0] = vPrestamos[0] + 1; break; case 2: vPrestamos[1] = vPrestamos[1] + 1; break; case 3: vPrestamos[2] = vPrestamos[2] + 1; break; case 4: vPrestamos[3] = vPrestamos[3] + 1; cantHipotecario++; break; case 5: vPrestamos[4] = vPrestamos[4] + 1; break; } condicion(); } mostrarVector(); } void mostrarVector() { for(i=0; i<5; i++) { } for(i=0; i<5; i++) { } } void condicion() { if((regProvencred.prestamo == 2) && ((regProvencred.codProvincia == 'd') || (regProvencred.codProvincia == 'd'))) { } if ( (regProvencred.codPrestamo == 5) && ((regProvencred.codProvincia == 'a') || (regProvencred.codProvincia == 'A')) ) { cantCorr++; } } void finalizar() { printf("\nEl porcentaje de prestamos hipotecarios es de: %.2f %c", porcentaje(cantHipotecario, cantTotal), '%'); } float porcentaje (int pCantHipotecario, int pCantTotal) { float porc; porc = (pCantHipotecario / pCantTotal) * 100; return porc; }