Article View: pl.comp.lang.pascal
Article #80382Re: Pytanie o ASCII i char ....
From: Rafał
Date: Tue, 21 Oct 2003 20:43
Date: Tue, 21 Oct 2003 20:43
98 lines
2896 bytes
2896 bytes
Użytkownik "Kicer" <michal.kic@nospam.interia.pl> napisał w wiadomości
news:bn43m8$eve$1@atlantis.news.tpi.pl...
> Rafał wrote:
>
> > Witam.
> > Mam problem z programem tego typu :
> >
> > Var
> > znak : Char;
> > Begin
> > Write('Wpisz dowolny znak : ');
> > ReadLn(znak);
> > WriteLn('Wpisales znak [', znak, '] o kodzie ASCII ', Ord(znak));
> > ReadLn;
> > End.
> >
>
> uses dos
> Var text : string;
>
> Begin
> Write('Wpisz dowolny text : ');
> ReadLn(text);
> for a:=1 to length(text) do
> Write(Ord(text[a])+' ');
> ReadLn;
> End.
>
> pisalem z glowy , powinno działać :)
>
> > Co musze zrobić ?
> > Jakas tablica ?
> > Petla ?
>
> pętla :)
>
> > Z góry serdecznie dziękuję za pomoc.
> > Pozdrawiam
>
> ja również
> --
> Kicer gg:3729519
> usun nospam. z adresu
Ok, a jak chcialbym teraz to przeksztalcic w tryb szestnatstkowy ?? ósemkowy
lub binarny ??
jak wykorzystać te liczby ??
Bo powiedzmy mam funkcję która mi zrobi z liczby dziesiętnej szestrastkową.
np.
function Dec2Hex(D: Word): string;
const
HexDigits: string[16] = '0123456789ABCDEF';
var s: string;
begin
s:='';
repeat
s:= HexDigits[D mod 16 + 1] +s;
D:= D div 16;
until D = 0;
Dec2Hex := s;
end;
no i ok
a moj program teraz (bez funkcji 16tkowej) wyglada tak
:
var
i:integer;
s:string;
procedure ascii;
begin
write('Wyraz w kodzie ASCII : ');
For i:=1 To Length(s) Do write(ord(s[i]),' ');
end;
begin;
clrscr;
Write('Podaj napis z trybie ASCII: ');
ReadLn(s);
ascii;
readkey;
end.
i ładnie mi się pokazują cyfry kodu ASCII w trybie dziesiętnym
I moje pytanie brzmi >>
Jak to teraz zamienić jeszcze dodatkowo na tryb szestnastkowy oraz ósemkowy
i binarny.
Z góry dziękuję za pomoc którą mi okazaliście do tej pory, ale prosze o
kolejną ;)
I góry THX ;]
Technical Details
Message-ID:
<bn45q7$q1s$1@atlantis.news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news2.icm.edu.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mailReferences:
<bn403u$o0f$1@nemesis.news.tpi.pl> <bn43m8$eve$1@atlantis.news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news2.icm.edu.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Rafał <rafal@wp.pl> Newsgroups: pl.comp.lang.pascal Subject: Re: Pytanie o ASCII i char .... Date: Tue, 21 Oct 2003 22:43:26 +0200 Organization: tp.internet - http://www.tpi.pl/ Lines: 100 Message-ID: <bn45q7$q1s$1@atlantis.news.tpi.pl> References: <bn403u$o0f$1@nemesis.news.tpi.pl> <bn43m8$eve$1@atlantis.news.tpi.pl> NNTP-Posting-Host: sp74.internetdsl.tpnet.pl X-Trace: atlantis.news.tpi.pl 1066769033 26684 80.55.93.74 (21 Oct 2003 20:43:53 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Tue, 21 Oct 2003 20:43:53 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit