Advertisement
Manimecker

Duracion llamadas

Mar 19th, 2011
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.65 KB | None | 0 0
  1. program llamadas;
  2.  
  3. uses crt;
  4.  
  5. VAR
  6. Dur, N1, P1, L1, Cont0, Cont01 : Integer;
  7. RE, RE2, Cont1, Cont2, Cont3 : Real;
  8. Tipo, Chos : Char;
  9.  
  10. BEGIN
  11.     Clrscr;
  12.     RE := 0;
  13.     Dur := 0;
  14.     N1 := 0;
  15.     P1 := 0;
  16.     L1 := 0;
  17.     Cont01 := 0;
  18.  
  19.     repeat
  20.         repeat
  21.             write('Duracion de la llamada (0 para terminar): ');
  22.             readln(Dur);
  23.             write('Introduzca el tipo de llamada. N:Nacional, P:Provincial, L:Local : ');
  24.             read(Tipo);
  25.  
  26.             if (Tipo = 'N') or (Tipo = 'n') then
  27.                 BEGIN
  28.                 N1 := N1+1;
  29.                 Cont1 := Cont1+Dur
  30.                 END;
  31.  
  32.             if (Tipo = 'P') or (Tipo = 'p') then
  33.                 BEGIN
  34.                 P1 := P1+1;
  35.                 Cont2 := Cont2+Dur
  36.                 END;
  37.  
  38.             if (Tipo = 'L') or (Tipo = 'l') then
  39.                 BEGIN
  40.                 L1 := L1+1;
  41.                 Cont3 := Cont3+Dur
  42.                 END;
  43.  
  44.             Cont01 := Cont01+1;
  45.             Cont0 := Cont0+Dur;
  46.             RE := RE+Dur;
  47.         until Dur = 0;
  48.  
  49.         if (Dur = 0) then
  50.             BEGIN
  51.             Cont01 := Cont01-1
  52.             END;
  53.  
  54.         RE2 := RE/Cont01;
  55.  
  56.         writeln('   -Especificacion llamadas Nacionales, Provinciales y Locales-');
  57.         writeln('El numero de llamadas nacionales a sido: ', N1, ' y su duracion: ', Cont1:0:2);
  58.         writeln('El numero de llamadas provinciales a sido: ', P1, ' y su duracion: ', Cont2:0:2);
  59.         writeln('El numero de llamadas locales a sido: ', L1, ' y su duracion: ', Cont3:0:2);
  60.         writeln();
  61.         writeln('   -Totales- ');
  62.         writeln('>Numero de llamadas: ', Cont01);
  63.         writeln('>Duracion total : ', RE:0:1);
  64.         writeln('>Duracion media : ', RE2:0:1);
  65.         writeln();
  66.         write('Desea continuar para realizar otra lista de llamadas? (S/N): ');
  67.         read(Chos)
  68.     until (Chos = 'n') or (Chos = 'N');
  69. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement