another c++ problem: doesnt show messages

Thread Solved
Reply

Join Date: Jul 2008
Posts: 58
Reputation: gispe is an unknown quantity at this point 
Solved Threads: 0
gispe gispe is offline Offline
Junior Poster in Training

another c++ problem: doesnt show messages

 
0
  #1
Jul 25th, 2008
hi!
im havin a problem with a program ive made.
problem is that doesnt show messages. dont know whats wrong
also attach the program


  1. // cartas_paquetes_v3.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6.  
  7.  
  8. int _tmain(int argc, _TCHAR* argv[])
  9. {
  10. using namespace std;
  11.  
  12. char dia, tipo_servicio, empezar;
  13. float peso;
  14.  
  15. int total_carta, total_paquete1000, total_paquete;
  16. int carta_siguiente_normal = 0, carta_sig_prioritario = 0; // TOTALES PARCIALES DE CARTAS
  17.  
  18. float costo_p_siguiente_prioritario = 0, costo_p_siguiente_normal = 0, costo_p_dos_dias = 0; // COSTO DE PAQUETES
  19. float paquete_siguiente_prioritario = 0, paquete_siguiente_normal = 0, paquete_dos_dias = 0; // CONTADORES IND. PAQ.
  20.  
  21. float costo_p_siguiente_prioritario_1000 = 0, costo_p_siguiente_normal_1000 = 0, costo_p_dos_dias_1000 = 0; // CONT. 1000 GR
  22. float total_p_siguiente_prioritario_1000 = 0, total_p_siguiente_normal_1000 = 0, total_p_dos_dias_1000 = 0;
  23.  
  24. float totales_caja = 0, totales_paquete = 0;
  25. float total_dia_siguiente_prioritario = 0, total_dia_siguiente_normal = 0, total_dos_dias_o_mas = 0;
  26.  
  27. int costo_paquete_1000_sp = 0, costo_paquete_1000_sn = 0, costo_p_dos_dias_1000_2d = 0;
  28. int costo_carta, costo_paquete_sp = 0, costo_paquete_normal = 0, costo_tot_2d = 0;
  29.  
  30. int costo_total = 0;
  31. int costo_total_paquetes = 0;
  32.  
  33. int costo_sp, costo_sn = 0, costo_2d = 0;
  34.  
  35. float porcentaje_sp = 0, porcentaje_sn = 0, porcentaje_2d = 0;
  36.  
  37.  
  38. cout << " Empezar?" << "\n";
  39. cout << " 4 - si" << "\n";
  40. cout << " 5 - no" << "\n";
  41. cin >> empezar;
  42.  
  43. while (empezar != 4)
  44. {
  45. cout << " A enviar: " << "\n";
  46. cout << " 1 - carta" << "\n";
  47. cout << " 2 - paquete" << "\n";
  48. cin >> dia;
  49. cout << "\n";
  50.  
  51. cout << " Ingrese el dia de entrega: " << "\n";
  52. cout << " 7 - Dia siguiente prioritario" << "\n";
  53. cout << " 8 - Dia siguiente normal" << "\n";
  54. cout << " 9 - Dos dias o mas" << "\n";
  55. cin >> tipo_servicio;
  56. cout << "\n";
  57.  
  58. cout << " Ingrese peso a enviar: ";
  59. cin >> peso;
  60. cout << "\n";
  61.  
  62. while (peso <= 30)
  63. {
  64. costo_carta = 8;
  65.  
  66. if (dia == 7)
  67. {
  68. carta_sig_prioritario +=1;
  69. cout << " Se le cobraran 8$" << "\n";
  70. }
  71. break;
  72.  
  73. if (dia == 8)
  74. {
  75. carta_siguiente_normal +=1;
  76. cout << " Se le cobraran 8$" << "\n";
  77. }
  78. break;
  79. if (dia == 9)
  80. cout << " No disponible" << "\n";
  81.  
  82. total_carta++;
  83. }
  84.  
  85. while (peso > 30)
  86. {
  87. if ((peso <= 1000) && (dia == 7))
  88. {
  89. costo_p_siguiente_prioritario = 25;
  90. paquete_siguiente_prioritario +=1;
  91. cout << " Se le cobraran $25 " << "\n";
  92. costo_paquete_sp +=25;
  93. }
  94. break;
  95. if ((peso <= 1000) && (dia == 8))
  96. {
  97. costo_p_siguiente_normal = 20;
  98. paquete_siguiente_normal +=1;
  99. cout << " Se le cobraran $20 " << "\n";
  100. costo_paquete_normal +=20;
  101. }
  102. break;
  103. if ((peso <= 1000) && (dia == 9))
  104. {
  105. costo_p_dos_dias = 15;
  106. paquete_dos_dias +=1;
  107. costo_tot_2d +=15;
  108. cout << " Se le cobraran $15 " << "\n";
  109. }
  110. total_paquete ++;
  111. }
  112. for (total_paquete1000 = 0; peso > 1000; total_paquete1000 ++)
  113. {
  114. if (dia == 7)
  115. {
  116. total_p_siguiente_prioritario_1000 += 1;
  117. costo_p_siguiente_prioritario_1000 = costo_p_siguiente_prioritario + (((peso - 1000)/500)*2);
  118. costo_paquete_1000_sp += costo_p_siguiente_prioritario_1000;
  119. cout << " Se le cobrarán: " << costo_p_siguiente_prioritario_1000 << " pesos";
  120. }
  121. break;
  122. if (dia == 8)
  123. {
  124. total_p_siguiente_normal_1000 += 1;
  125. costo_p_siguiente_normal_1000 = costo_p_siguiente_normal + (((peso - 1000)/500)*2);
  126. costo_paquete_1000_sn += costo_p_siguiente_normal_1000;
  127. cout << " Se le cobrarán: " << costo_p_siguiente_normal_1000 << " pesos";
  128. }
  129. break;
  130. if (dia == 9)
  131. {
  132. total_p_dos_dias_1000 += 1;
  133. costo_p_dos_dias_1000 = costo_p_dos_dias_1000 + (((peso - 1000)/500)*2);
  134. costo_p_dos_dias_1000_2d += costo_p_dos_dias_1000;
  135. cout << " Se le cobrarán: " << costo_p_dos_dias_1000 << " pesos";
  136. }
  137. }
  138. }
  139. totales_caja = total_carta; // total de carta
  140. totales_paquete = total_paquete + total_paquete1000;
  141.  
  142. /* total_dia_siguiente_prioritario = carta_sig_prioritario + paquete_siguiente_prioritario + paquete_siguiente_normal;
  143.  total_dia_siguiente_normal = carta_siguiente_normal + paquete_siguiente_normal + total_p_siguiente_normal_1000;
  144.  total_dos_dias_o_mas = total_p_dos_dias_1000; */
  145.  
  146. costo_total = costo_paquete_1000_sp + costo_paquete_1000_sn + costo_p_dos_dias_1000_2d + costo_carta + costo_paquete_sp + costo_paquete_normal + costo_tot_2d;
  147. costo_total_paquetes = costo_paquete_1000_sp + costo_paquete_1000_sn + costo_p_dos_dias_1000_2d + costo_paquete_sp + costo_paquete_normal + costo_tot_2d;
  148.  
  149. costo_sp = costo_paquete_1000_sp + costo_carta + costo_paquete_sp;
  150. costo_sn = costo_paquete_1000_sn + + costo_paquete_normal + costo_carta;
  151. costo_2d = costo_p_dos_dias_1000_2d + costo_paquete_normal;
  152.  
  153. porcentaje_sp = ((costo_sp*100)/costo_total);
  154. porcentaje_sn = ((costo_sn*100)/costo_total);
  155. porcentaje_2d = ((costo_2d*100)/costo_total);
  156.  
  157. cout << "El costo total es: " << costo_total << "\n";
  158. cout << "El costo en dia siguiente prioritario es: " << costo_sp << "\n";
  159. cout << "El costo en dia siguiente normal es:" << costo_sn << "\n";
  160. cout << "El costo en dos dias o mas es: " << costo_2d << "\n";
  161.  
  162. cout << "El porcentaje de dia siguiente prioritario es: " << porcentaje_sp << "\n";
  163. cout << "El porcentaje de dia siguiente normal es: " << porcentaje_sn << "\n";
  164. cout << "El porcentaje de dos dias o mas es: " << porcentaje_2d << "\n";
  165.  
  166.  
  167. system ("PAUSE");
  168.  
  169. return 0;
  170.  
  171. }
Attached Files
File Type: cpp cartas_paquetes_v3.cpp (5.4 KB, 1 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,152
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1437
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: another c++ problem: doesnt show messages

 
0
  #2
Jul 26th, 2008
Here is the output I get
  1. Empezar?
  2. 4 - si
  3. 5 - no
There are quite a few compiler warnings -- conversion from float to int may loose data. And a couple of uninitialized variables are used.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: another c++ problem: doesnt show messages

 
0
  #3
Jul 26th, 2008
Apropos, move #include <iostream> to <stdafx.h> from the main file. That's just what for stdafx.h exists. Place all <...> includes in stdafx.h. Place your own headers ("...") in your source file (or in stdafx.h too).
Read VS help about pre-compiled headers in VC++.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: another c++ problem: doesnt show messages

 
0
  #4
Jul 26th, 2008
I'm sorry, read stdafx.h, not <stdafx.h> in my prev post.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC