Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program imagecalc;
- uses
- crt;
- var
- /// Image vars START
- imagesizeV, imagesizeH : integer;
- bitdepth : integer;
- OutputImage : integer;
- /// Image vars END
- ///
- userChoice : string;
- ///
- /// Sound vars START
- soundLength : integer;
- sampleRate : integer;
- bitsPerSample : integer;
- stereomono : integer;
- OutputSound : integer;
- /// Sound vars END
- procedure DisplayMenu;
- begin
- writeln('###############################');
- writeln('## A : Image size calculator ##');
- writeln('## B : Sound size calculator ##');
- writeln('## Q : Quit ##');
- writeln('###############################');
- end;
- procedure ImageCalculator;
- begin
- writeln('Image size calculation');
- writeln('----------------------');
- writeln('Width:');
- readln(imagesizeH);
- writeln('Height:');
- readln(imagesizeV);
- writeln('Bit depth');
- readln(bitdepth);
- OutputImage:= (imagesizeH * imagesizeV * bitdepth) div 8;
- writeln('The output size of the image is ',OutputImage,' bytes.');
- readln;
- end;
- procedure SoundCalculator;
- begin
- writeln('Sound size calculation');
- writeln('----------------------');
- writeln('Length of sound file:');
- readln(soundLength);
- writeln('Sample rate:');
- readln(sampleRate);
- writeln('Bits per sample:');
- readln(bitsPerSample);
- writeln('Channel count:');
- readln(stereomono);
- OutputSound:= (soundLength * sampleRate * bitsPerSample) * stereomono;
- writeln('The output size of the sound file is ',OutputSound,' bytes.');
- readln;
- end;
- begin
- repeat
- DisplayMenu;
- readln(userChoice);
- //until (userChoice IN [1,2]);
- If userChoice = 'A' then
- begin
- ClrScr;
- ImageCalculator;
- Clrscr;
- end
- else if userChoice = 'B' then
- begin
- Clrscr;
- SoundCalculator;
- Clrscr;
- end
- else
- begin
- writeln('Wrong choice!');
- end;
- until userChoice = 'Q';
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement