كيف يتم ادخال سلسلة نصية و اضافة عناصرها الى مصفوفة ؟
#3
PHP كود :
program Project1;

{
$APPTYPE CONSOLE}

uses
  SysUtils
;

type
  TDynamicSA
= array of string;

function 
OccurrencesOfChar(const S: string; const C: char): integer;
var
  
i: Integer;
begin
  result 
:= 0;
  for 
i := 1 to Length(S) do
    if 
S[i] = C then
      inc
(result);
end;

var 
text:string;
count,Alpha:TDynamicSA;
i:Integer;
begin
 Writeln
('tapez votre texte ici : ')  ;
 
read(text);
 
text:=UpperCase(text)  ;
 for 
i:=1 to 26 do begin
 SetLength
(count,i+1);
  
SetLength(Alpha,i+1);
  
count[i] :=IntToStr(OccurrencesOfChar(text,Char(64+i)));
  
Alpha[i]:= Char(64+i);
 
end;
 for 
i:=1 to 26 do
 
Writeln(Alpha[i]+' : '+count[i]);

 
Readln;
Readln;
end. 
الرد


الردود في هذا الموضوع
كيف يتم ادخال سلسلة نصية و اضافة عناصرها الى مصفوفة ؟ - بواسطة onexite - 17-04-2014, 07:35 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم