hi ppl!
im here again :S with another problem, which, is more a question about if what im doing is ok.
the thing is i have to do a problem that counts the total of letters sent, the total of packages sent, total of letters and packages sent on the next day priority, on the next day normal, and the total if its sent over 2 days.
also i have to calculate a big total of letters and packages sent (i mean letters + packages in each day) and the percentage of the total of things sent on the next day priority, of the next day normal, and over 2 days.
i already have a code made, my question if its ok to put a for loop in the middle of a chain of ifs:
//A GENERAL FOR LOOP WOULD BE HERE
if ((peso < 30) && (dia = 7))
cout << " Se le cobraran 8$ " << "\n"; // these 3 are letters,
else if ((peso < 30) && (dia = 8))
cout << " Se le cobraran 5$ " << "\n";
else if ((peso < 30) && (dia = 9))
cout << " No esta disponible$ " << "\n";
//ANOTHER PUT A FOR LOOP HERE
else if ((peso > 30) && (peso < 1000) && (dia = 7)) // from here to the end, are packages
cout << " Se le cobraran 25$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 8))
cout << " Se le cobraran 20$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 9))
cout << " Se le cobraran 15$ " << "\n";
//AND ANOTHER ONE HERE
else if((peso > 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
cout << " Y 2$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2) + 2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 8) && (peso > 1000))
{
cout << " Se le cobraran 20$ " << "\n";
cout << " Y 1.5$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 9)&& (peso > 1000))
{
cout << " Se le cobraran 15$ " << "\n";
cout << " Y 1$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
what i want to do is this: the program must consider the hours in which the people work, so the first for loop would control that [for (hour = hour_begining; (hour > hour_begining) && (hour < hour_final); hour++) ]. now, when it comes to the other two for loops, i dont know if they will stop in any way the ifs, or do i have to write the code differently.
in the code:
peso = weight
dia = day
total_a_pagar = is what i have to pay if i send just one (its calculated only for the packages, if its a letter doesnt matter the weight, its a fixed price)
thanks for the help!!
gispe!!
ps: if anything isnt clear, ask me! and if whole code were necessary ill paste it!!
here is the code
// caja_paquete_2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace std;
char tipo_servicio, dia;
float peso, total_a_pagar = 0, diferencia; // CALCULA PRECIO UNITARIO DE CADA COSA
int total_paquete = 0, total_carta = 0; // TOTALES POR TIPO ENTREGA, incializadas
int total_dia_sig_prioritario = 0, total_dia_sig_normal = 0, total_2_dias_o_mas = 0; // TOTALES POR DIA, ya inicializadas
int totales_de_entregas = 0; // PARA QUE CALCULE EL TOTAL DE ENTREGAS, ya inicializadas
float porcentaje_dia_sig_prioritario, porcentaje_dia_siguiente_normal, porcentaje_dos_dias_o_mas; // PORCENTAJES
float dinero_recaudado = 0; // TOTAL DINERO RECAUDADO, ya inicializada
float hora, hora_fin, hora_inicio; // HORA DEL DIA PARA CARGAR LAS COSAS
cout << "Ingrese hora a la que empieza a trabajar (hh.mm): ";
cin >> hora_inicio;
cout << "\n";
cout << " Ingrese la hora a la que termina de trabajar (hh.mm): ";
cin >> hora_fin;
cout << "\n";
for (hora = hora_inicio; hora < hora_fin; hora++)
{
cout << " Ingrese tipo de servicio:" << "\n"; ////////
cout << " 1 - Carta" << "\n"; ////////
cout << " 2 - Paquete" << "\n"; //
cin >> tipo_servicio; //
//
cout << " Ingrese tipo de entrega: " << "\n"; // primer ingreso
cout << " 7 - Dia siguiente prioritario" << "\n"; // de datos
cout << " 8 - Dia siguiente normal" << "\n"; //
cout << " 9 - Dos dias o mas" << "\n"; //
cin >> dia; //
//
cout << " Ingrese peso EN GRAMOS a enviar: "; ////////
cin >> peso; ////////
cout << "\n";
if ((peso < 30) && (dia = 7)) //
cout << " Se le cobraran 8$ " << "\n"; //
else if ((peso < 30) && (dia = 8)) //
cout << " Se le cobraran 5$ " << "\n";
else if ((peso < 30) && (dia = 9))
cout << " No esta disponible$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 7))
cout << " Se le cobraran 25$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 8))
cout << " Se le cobraran 20$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 9))
cout << " Se le cobraran 15$ " << "\n";
else if((peso > 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
cout << " Y 2$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2) + 2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 8) && (peso > 1000))
{
cout << " Se le cobraran 20$ " << "\n";
cout << " Y 1.5$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 9)&& (peso > 1000))
{
cout << " Se le cobraran 15$ " << "\n";
cout << " Y 1$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
}
system ("PAUSE");
return 0;
}Salem meant you should wrap your code in code tags (the # button on the top, or just type [ code] YOUR CODE HERE [/code], w/o the spaces between '[' and "code").
Do you want the for loop to be part of this conditional:
else if ((peso > 30) && (peso < 1000) && (dia = 9))
cout << " Se le cobraran 15$ " << "\n";
//for loop only executed if peso is between 30 and 1000 and dia is 9
If so, just wrap the code in curly brackets:
else if ((peso > 30) && (peso < 1000) && (dia = 9))
{
cout << " Se le cobraran 15$ " << "\n";
for(;;)
//your loop here
}
//next else if condition
If you meant that the loop is executed regardless of the above conditional, you can also do that, though the else if after it would need to become a regular if:
/*else*/if((peso > 1000) && (dia = 7))so, u mean that i should put the for inside the if, n wont modify the ifs instructions?
cuz i have to count the letters sent every day, and then sum it up
> my question if its ok to put a for loop in the middle of a chain of ifs
Yes it's ok. Try put it in and see what happens. If it messes up it's the logic that's wrong.
Here's the code in code-tags.
// caja_paquete_2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace std;
char tipo_servicio, dia;
float peso, total_a_pagar = 0, diferencia; // CALCULA PRECIO UNITARIO DE CADA COSA
int total_paquete = 0, total_carta = 0; // TOTALES POR TIPO ENTREGA, incializadas
int total_dia_sig_prioritario = 0, total_dia_sig_normal = 0, total_2_dias_o_mas = 0; // TOTALES POR DIA, ya inicializadas
int totales_de_entregas = 0; // PARA QUE CALCULE EL TOTAL DE ENTREGAS, ya inicializadas
float porcentaje_dia_sig_prioritario, porcentaje_dia_siguiente_normal, porcentaje_dos_dias_o_mas; // PORCENTAJES
float dinero_recaudado = 0; // TOTAL DINERO RECAUDADO, ya inicializada
float hora, hora_fin, hora_inicio; // HORA DEL DIA PARA CARGAR LAS COSAS
cout << "Ingrese hora a la que empieza a trabajar (hh.mm): ";
cin >> hora_inicio;
cout << "\n";
cout << " Ingrese la hora a la que termina de trabajar (hh.mm): ";
cin >> hora_fin;
cout << "\n";
for (hora = hora_inicio; hora < hora_fin; hora++)
{
cout << " Ingrese tipo de servicio:" << "\n"; ////////
cout << " 1 - Carta" << "\n"; ////////
cout << " 2 - Paquete" << "\n"; //
cin >> tipo_servicio; //
//
cout << " Ingrese tipo de entrega: " << "\n"; // primer ingreso
cout << " 7 - Dia siguiente prioritario" << "\n"; // de datos
cout << " 8 - Dia siguiente normal" << "\n"; //
cout << " 9 - Dos dias o mas" << "\n"; //
cin >> dia; //
//
cout << " Ingrese peso EN GRAMOS a enviar: "; ////////
cin >> peso; ////////
cout << "\n";
if ((peso < 30) && (dia = 7)) //
cout << " Se le cobraran 8$ " << "\n"; //
else if ((peso < 30) && (dia = 8)) //
cout << " Se le cobraran 5$ " << "\n";
else if ((peso < 30) && (dia = 9))
cout << " No esta disponible$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 7))
cout << " Se le cobraran 25$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 8))
cout << " Se le cobraran 20$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 9))
cout << " Se le cobraran 15$ " << "\n";
else if((peso > 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
cout << " Y 2$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2) + 2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 8) && (peso > 1000))
{
cout << " Se le cobraran 20$ " << "\n";
cout << " Y 1.5$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 9)&& (peso > 1000))
{
cout << " Se le cobraran 15$ " << "\n";
cout << " Y 1$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
}
system ("PAUSE");
return 0;
}
Sorry for "bumping" this thread, but it really gave me a headache to see the code like this and I'm sure it's giving other people a headache too.
Use code tags please! People will be more inclined to help when you do.
so, u mean that i should put the for inside the if, n wont modify the ifs instructions?
cuz i have to count the letters sent every day, and then sum it up
Please don't use leet-speak. He's asking whether the for-loop should always be executed, regardless of whether the if-condition is true. If it should always be executed, then don't put the for-loop inside the if-statement. If the for-loop should only be executed if the the if-condition is true, then put the for-loop inside the if-statement's brackets.
I don't understand what you mean by this sentence, the red part in particular.so, u mean that i should put the for inside the if, n wont modify the ifs instructions?
Do you mean "execute" rather than "modify"? The machine code instructions can't be modified when you run the program.
well, im back here: same program.
i made some modifications n now runs, but the thing is that it puts on screen same message indefinitely.
it reads the hours it worked, what i want to send (package or letter), and the day i want to send it. n then it returns the cost (indefinitely).
there is the code attached, if u want to try it
#
// cartas_paquetes_v3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
char dia, tipo_servicio, horario_trabajo;
float peso, total_a_pagar = 0, diferencia; // CALCULA PRECIO UNITARIO DE CADA COSA
int total_paquete = 0, total_carta = 0; // TOTALES POR TIPO ENTREGA, incializadas
int total_dia_sig_prioritario = 0, total_dia_sig_normal = 0, total_2_dias_o_mas = 0; // TOTALES POR DIA, ya inicializadas
int total_dia_siguiente_prioritario_p = 0, total_dia_siguiente_prioritario_c = 0; // TOTALES SIG. PRIO C Y P , inicializadas
int total_dia_siguiente_prioritario_p1 = 0, total_dia_siguiente_normal_p1 = 0, total_dos_dias_o_mas_p1 = 0; // para paquetes mayores a 1000, inicializadas
int total_dia_siguiente_normal_p = 0, total_dia_siguiente_normal_c = 0; // TOTAL DIA SIG NORMAL, inicializadas
int total_dos_dias_o_mas_p = 0; // TOTAL DOS DIAS O MAS, inicializadas
int totales_de_entregas = 0; // PARA QUE CALCULE EL TOTAL DE ENTREGAS, ya inicializadas
float porcentaje_dia_sig_prioritario, porcentaje_dia_siguiente_normal, porcentaje_dos_dias_o_mas; // PORCENTAJES
float dinero_recaudado = 0; // TOTAL DINERO RECAUDADO, ya inicializada
float hora = 0, hora_fin, hora_inicio; // HORA DEL DIA PARA CARGAR LAS COSAS
int tp, tc; // CONTADORES tp, para paquete tc, para carta
cout << "Ingrese hora a la que empieza a trabajar (hh.mm): ";
cin >> hora_inicio; cout << "\n";
cout << " Ingrese la hora a la que termina de trabajar (hh.mm): ";
cin >> hora_fin; cout << "\n";
for (hora = hora_inicio; hora < hora_fin; hora++)
{
cout << " Ingrese tipo de servicio:" << "\n";
cout << " 1 - Carta" << "\n";
cout << " 2 - Paquete" << "\n";
cin >> tipo_servicio;
cout << " Ingrese tipo de entrega: " << "\n";
cout << " 7 - Dia siguiente prioritario" << "\n";
cout << " 8 - Dia siguiente normal" << "\n";
cout << " 9 - Dos dias o mas" << "\n";
cin >> dia;
cout << " Ingrese peso EN GRAMOS a enviar: ";
cin >> peso;
cout << "\n";
for (tc = 1; tipo_servicio = 1; tc++)
{
if (dia = 7)
{
cout << " Se le cobraran 8$ " << "\n";
total_dia_siguiente_prioritario_c += 1;
}
else if (dia = 8)
{
cout << " Se le cobraran 5$ " << "\n";
total_dia_siguiente_normal_c += 1;
}
else if (dia = 9)
cout << " No esta disponible$ " << "\n";
}
for (tp = 1; tipo_servicio = 2; tp++)
{
if ((peso > 30) && (peso < 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
total_dia_siguiente_prioritario_p += 1;
}
else if ((peso > 30) && (peso < 1000) && (dia = 8))
{
cout << " Se le cobraran 20$ " << "\n";
total_dia_siguiente_normal_p += 1;
}
else if ((peso > 30) && (peso < 1000) && (dia = 9))
{
cout << " Se le cobraran 15$ " << "\n";
total_dos_dias_o_mas_p += 1;
}
else if((peso > 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
cout << " Y 2$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2) + 2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
total_dia_siguiente_prioritario_p1 += 1;
}
else if ((dia = 8) && (peso > 1000))
{
cout << " Se le cobraran 20$ " << "\n";
cout << " Y 1.5$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
total_dia_siguiente_normal_p1 += 1;
}
else if ((dia = 9)&& (peso > 1000))
{
cout << " Se le cobraran 15$ " << "\n";
cout << " Y 1$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
total_dos_dias_o_mas_p1 += 1;
}
}
}
total_paquete = total_dia_siguiente_normal_p + total_dos_dias_o_mas_p + total_dia_siguiente_prioritario_p; // TOTAL PAQUETE
total_carta = total_dia_siguiente_prioritario_c + total_dia_siguiente_normal_c; //TOTAL CARTAS
total_dia_sig_prioritario = total_dia_siguiente_prioritario_p + total_dia_siguiente_prioritario_c; //TOTAL DIA SIGUIENTE PRIORITARIO
total_dia_sig_normal = total_dia_siguiente_normal_p + total_dia_siguiente_normal_c; // TOTAL DIA SIGUIENTE NORMAL
total_2_dias_o_mas = total_dos_dias_o_mas_p; // TOTAL DOS DIAS O MAS
totales_de_entregas = total_paquete + total_carta; //TOTAL DINERO RECAUDADO
// dinero_recaudado = ;
system ("PAUSE");
return 0;
}// cartas_paquetes_v3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
char dia, tipo_servicio, horario_trabajo;
float peso, total_a_pagar = 0, diferencia; // CALCULA PRECIO UNITARIO DE CADA COSA
int total_paquete = 0, total_carta = 0; // TOTALES POR TIPO ENTREGA, incializadas
int total_dia_sig_prioritario = 0, total_dia_sig_normal = 0, total_2_dias_o_mas = 0; // TOTALES POR DIA, ya inicializadas
int total_dia_siguiente_prioritario_p = 0, total_dia_siguiente_prioritario_c = 0; // TOTALES SIG. PRIO C Y P , inicializadas
int total_dia_siguiente_prioritario_p1 = 0, total_dia_siguiente_normal_p1 = 0, total_dos_dias_o_mas_p1 = 0; // para paquetes mayores a 1000, inicializadas
int total_dia_siguiente_normal_p = 0, total_dia_siguiente_normal_c = 0; // TOTAL DIA SIG NORMAL, inicializadas
int total_dos_dias_o_mas_p = 0; // TOTAL DOS DIAS O MAS, inicializadas
int totales_de_entregas = 0; // PARA QUE CALCULE EL TOTAL DE ENTREGAS, ya inicializadas
float porcentaje_dia_sig_prioritario, porcentaje_dia_siguiente_normal, porcentaje_dos_dias_o_mas; // PORCENTAJES
float dinero_recaudado = 0; // TOTAL DINERO RECAUDADO, ya inicializada
float hora = 0, hora_fin, hora_inicio; // HORA DEL DIA PARA CARGAR LAS COSAS
int tp, tc; // CONTADORES tp, para paquete tc, para carta
cout << "Ingrese hora a la que empieza a trabajar (hh.mm): ";
cin >> hora_inicio; cout << "\n";
cout << " Ingrese la hora a la que termina de trabajar (hh.mm): ";
cin >> hora_fin; cout << "\n";
for (hora = hora_inicio; hora < hora_fin; hora++)
{
cout << " Ingrese tipo de servicio:" << "\n";
cout << " 1 - Carta" << "\n";
cout << " 2 - Paquete" << "\n";
cin >> tipo_servicio;
cout << " Ingrese tipo de entrega: " << "\n";
cout << " 7 - Dia siguiente prioritario" << "\n";
cout << " 8 - Dia siguiente normal" << "\n";
cout << " 9 - Dos dias o mas" << "\n";
cin >> dia;
cout << " Ingrese peso EN GRAMOS a enviar: ";
cin >> peso;
cout << "\n";
for (tc = 1; tipo_servicio = 1; tc++)
{
if (dia = 7)
{
cout << " Se le cobraran 8$ " << "\n";
total_dia_siguiente_prioritario_c += 1;
}
else if (dia = 8)
{
cout << " Se le cobraran 5$ " << "\n";
total_dia_siguiente_normal_c += 1;
}
else if (dia = 9)
cout << " No esta disponible$ " << "\n";
}
for (tp = 1; tipo_servicio = 2; tp++)
{
if ((peso > 30) && (peso < 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
total_dia_siguiente_prioritario_p += 1;
}
else if ((peso > 30) && (peso < 1000) && (dia = 8))
{
cout << " Se le cobraran 20$ " << "\n";
total_dia_siguiente_normal_p += 1;
}
else if ((peso > 30) && (peso < 1000) && (dia = 9))
{
cout << " Se le cobraran 15$ " << "\n";
total_dos_dias_o_mas_p += 1;
}
else if((peso > 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
cout << " Y 2$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2) + 2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
total_dia_siguiente_prioritario_p1 += 1;
}
else if ((dia = 8) && (peso > 1000))
{
cout << " Se le cobraran 20$ " << "\n";
cout << " Y 1.5$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
total_dia_siguiente_normal_p1 += 1;
}
else if ((dia = 9)&& (peso > 1000))
{
cout << " Se le cobraran 15$ " << "\n";
cout << " Y 1$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
total_dos_dias_o_mas_p1 += 1;
}
}
}
total_paquete = total_dia_siguiente_normal_p + total_dos_dias_o_mas_p + total_dia_siguiente_prioritario_p; // TOTAL PAQUETE
total_carta = total_dia_siguiente_prioritario_c + total_dia_siguiente_normal_c; //TOTAL CARTAS
total_dia_sig_prioritario = total_dia_siguiente_prioritario_p + total_dia_siguiente_prioritario_c; //TOTAL DIA SIGUIENTE PRIORITARIO
total_dia_sig_normal = total_dia_siguiente_normal_p + total_dia_siguiente_normal_c; // TOTAL DIA SIGUIENTE NORMAL
total_2_dias_o_mas = total_dos_dias_o_mas_p; // TOTAL DOS DIAS O MAS
totales_de_entregas = total_paquete + total_carta; //TOTAL DINERO RECAUDADO
// dinero_recaudado = ;
system ("PAUSE");
return 0;
}Code tags work like this. Don't use icode tags.
[code]
// paste code here
[/code]
or
[code=cplusplus]
// paste code here. This adds line numbers
// and C++ syntax highlighting.
[/code]
Make sure there are no spaces between the opening brackets and the closing brackets
[code] <-- correct
[ code ] <-- incorrect
My Spanish isn't what it used to be, so I'm not exactly sure what's going on, but I ran it and got the infinite loop and I think probably the culprit is that you are confusing the = operator and the == operator in these for-loops:
for (tc = 1; tipo_servicio = 1; tc++)
The other for-loops appear to have the same problem. = is the assignment operator, not the comparison operator. Try changing
tipo_servicio = 1
to
tipo_servicio == 1
on this for-loop and the others and see if that helps.
scratch this - didn't see the second page
btw, how do you get the code tag to come up properly without it thinking it's an actual code tag?
scratch this - didn't see the second page
btw, how do you get the code tag to come up properly without it thinking it's an actual code tag?
Use the noparse tag.
[noparse]
[code=cplusplus]
// pasted code here
[/code]
[/noparse]