Programalama > PASCAL

Etiketler: taban, aritmatigi

Ort. 0
Puan ver:
program binary (Input,Output);
var
   kalan,
   bolum,
   son1,
   base,
   number:Integer;

   n,
   son2,
   inner,
   result:Real;

   press : char;




procedure game;

          begin
writeLn;
WriteLn('Please first enter then base that you want to convert into >');
ReadLn(base);
while (base < 2) or (base > 10) do
begin
WriteLn('Warning! Please choose your base between 2 and 9 (2 and 9 are also Ok) >');
ReadLn (base);
end;
writeln;
WriteLn('Please enter a number that you want to convert into base ',base,'  >  ');
ReadLn(number);
n := 0;

while number > 32767 do
   begin
        writeln;
        writeln('WARNING!!! = Your number is too large.Please enter a smaller one');
        writeln('Please choose your number between 0 and 32767! --> ');
        Readln(number);
        writeln;
        writeln
   end ;

bolum := number div base;
kalan := number mod base;
result:=kalan ;


repeat
      begin
           son1:=bolum;
           {writeLn('bolum= ',bolum,'  ','kalan= ',kalan);}
           bolum := bolum div base;
           kalan := son1 mod base;
           n:= n +1 ;
           {writeLn('bolum= ',bolum,'  ','kalan= ',kalan);}
           inner:=Exp(n * Ln(10)) ;
           result:=(kalan * inner) +  result
           {WriteLn(result:1:0)}
      end;
until
 (bolum =0)  ;
     writeLn;
     writeLn;
     writeLn;
    {result:=(kalan * inner) + (bolum * (inner+1)) + result ;}
    writeLn('-------------------------------------------------------------------------------');
    writeln('        The base  ',base,'  correspondence of your number  ',number,' ==>','  ','(',result:1:0,')' );
    writeLn('-------------------------------------------------------------------------------');
writeLn;
writeLn;
writeLn;

WriteLn('If you want to convert another number please press ( Y ) then press enter');
WriteLn('If you want to exit this program just press ENTER');
ReadLn(press);
               if (press='Y') or (press='y') then
               game


end ;



begin

WriteLn('     WELLCOME to the program.This program is designed by TOLGA UYGUNOL');
WriteLn(' By this program you can convert your integers into the base that you choose');
WriteLn;
WriteLn;
WriteLn;

game
end.


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.