Good afternoon, I have the following exercise in which I ask for Name, Cedula, and also the amount of liners produced daily, but we must also take into account that it must be done per week (assuming that the month has 4 weeks).
The program works as follows:
I ask for the name and the worker's cedula, then for each day of the week (5 days), I ask how many linings it has produced, when the first week ends, it should print the weekly report , then It would happen to do the same but with week 2 and so on, when it ends with that worker who goes to the next one.
As it is currently the program, it does everything right until it gets to print the weekly report, it is there where I print the name and the cedula, but the other data does not print them and in passing the message "It has stopped working ... ".
int main(int argc, char const *argv[])
{
char nombre[9][30];
int cedula[9];
//int i = 0, a = 0, b = 0, c = 0;
int i, a, b, c;
const float sueldo = 15000, bono = 8250;
float forro_dia[5][5];
float total_semana[5];
for (int i = 1; i <= 9; i++)
{
system("cls");
cout<<"< = = = = = F A B R I C A de F O R R O S para V E H I C U L O S = = = = = >";
cout<<"\n\nIngrese el Nombre del Trabajador: "<<i<<". ";
cin.getline(nombre[i], sizeof(nombre));
cout<<"\nCedula del Trabajador: ";
cin>>cedula[c];
for (int a = 1; a <= 5; a++)
{
for (int b = 1; b <= 1; b++)
{
cout<<"\nCantidad de Forros Producidos en el Dia: "<<a<<". "<<"de la Semana: "<<b<<". ";
cin>>forro_dia[a][b];
total_semana[b] = total_semana[b] + forro_dia[a][b];
if (forro_dia[a][b] >= 80)
{
total_semana[b] = sueldo + bono;
}else
total_semana[b] = sueldo;
}
}
system("cls");
cout<<fixed<<setprecision(2);
cout<<"< = = = = = F A B R I C A de F O R R O S para V E H I C U L O S = = = = = >";
cout<<"\n\n< = = R E C I B O S E M A N A L = = >";
cout<<"\n\nTrabajador: "<<nombre[i];
cout<<"\nCedula: "<<cedula[c];
cout<<"\nForros Producidos en la Semana: "<<forro_dia[a][b];
cout<<"\n\nTotal a Pagar: Bs. "<<total_semana[b];
getchar();
getchar();
}
return 0;
}