•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 396,989 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,916 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 359 | Replies: 14
![]() |
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Rep Power: 0
Solved Threads: 0
hi ppl!
im here again
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:
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!!
im here again
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!!
Last edited by Tekmaven : Jul 24th, 2008 at 2:05 am. Reason: Code tags
If we asked for more code, would you still post it without [code][/code] tags?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Rep Power: 0
Solved Threads: 0
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;
} Last edited by Tekmaven : Jul 24th, 2008 at 2:07 am. Reason: Code tags
•
•
Join Date: Jan 2008
Location: USA East Cost
Posts: 386
Reputation:
Rep Power: 1
Solved Threads: 37
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:
If so, just wrap the code in curly brackets:
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:
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 conditionIf 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))
Last edited by CoolGamer48 : Jul 23rd, 2008 at 5:39 pm.
I'm a student. If my statements seem too absolute, feel free to coat them with "In my opinion..." or "I believe...".
•
•
Join Date: Jun 2008
Location: WA, USA
Posts: 645
Reputation:
Rep Power: 3
Solved Threads: 53
Here's the code in code-tags.
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.
c++ Syntax (Toggle Plain Text)
// 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.
Last edited by Alex Edwards : Jul 23rd, 2008 at 7:07 pm.
•
•
Join Date: Jan 2008
Posts: 1,449
Reputation:
Rep Power: 6
Solved Threads: 185
•
•
•
•
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.
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Rep Power: 0
Solved Threads: 0
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
#
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
#
c++ Syntax (Toggle Plain Text)
// 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; }
Last edited by Tekmaven : Jul 24th, 2008 at 2:08 am. Reason: Code tags
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Rep Power: 0
Solved Threads: 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;
}
Last edited by Tekmaven : Jul 24th, 2008 at 2:09 am. Reason: Code tags
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
&nbs


