Advertisement
Guest User

Untitled

a guest
May 30th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. program imagecalc;
  2. uses
  3. crt;
  4.  
  5. var
  6. /// Image vars START
  7. imagesizeV, imagesizeH : integer;
  8. bitdepth : integer;
  9. OutputImage : integer;
  10. /// Image vars END
  11. ///
  12. userChoice : string;
  13. ///
  14. /// Sound vars START
  15. soundLength : integer;
  16. sampleRate : integer;
  17. bitsPerSample : integer;
  18. stereomono : integer;
  19. OutputSound : integer;
  20. /// Sound vars END
  21.  
  22.  
  23. procedure DisplayMenu;
  24. begin
  25. writeln('###############################');
  26. writeln('## A : Image size calculator ##');
  27. writeln('## B : Sound size calculator ##');
  28. writeln('## Q : Quit ##');
  29. writeln('###############################');
  30. end;
  31. procedure ImageCalculator;
  32. begin
  33. writeln('Image size calculation');
  34. writeln('----------------------');
  35. writeln('Width:');
  36. readln(imagesizeH);
  37. writeln('Height:');
  38. readln(imagesizeV);
  39. writeln('Bit depth');
  40. readln(bitdepth);
  41. OutputImage:= (imagesizeH * imagesizeV * bitdepth) div 8;
  42. writeln('The output size of the image is ',OutputImage,' bytes.');
  43. readln;
  44. end;
  45. procedure SoundCalculator;
  46. begin
  47. writeln('Sound size calculation');
  48. writeln('----------------------');
  49. writeln('Length of sound file:');
  50. readln(soundLength);
  51. writeln('Sample rate:');
  52. readln(sampleRate);
  53. writeln('Bits per sample:');
  54. readln(bitsPerSample);
  55. writeln('Channel count:');
  56. readln(stereomono);
  57. OutputSound:= (soundLength * sampleRate * bitsPerSample) * stereomono;
  58. writeln('The output size of the sound file is ',OutputSound,' bytes.');
  59. readln;
  60. end;
  61.  
  62. begin
  63. repeat
  64. DisplayMenu;
  65. readln(userChoice);
  66. //until (userChoice IN [1,2]);
  67. If userChoice = 'A' then
  68. begin
  69. ClrScr;
  70. ImageCalculator;
  71. Clrscr;
  72. end
  73. else if userChoice = 'B' then
  74. begin
  75. Clrscr;
  76. SoundCalculator;
  77. Clrscr;
  78. end
  79. else
  80. begin
  81. writeln('Wrong choice!');
  82. end;
  83. until userChoice = 'Q';
  84. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement