آرشیو برای ‘برنامه نویسی’ دسته ها
رمز خوان
program ramz;
uses crt
const b=’*';
var ccc,i,k,j,e,se:word;a:array [1..220] of string[1]; sav,s:char;
pass1,pass2,pass3:string[25];c:char;
f:string[25];ff:text;
loc:array [1..20] of string;
mm,tt:word;name,pp:string;dd:text;
procedure starting;
begin
clrscr;
writeln(‘*W E L C O M E T O M I S T R Y S Y S T E M*’);
writeln;writeln;
writeln(‘for enter password please: : ۰۱′);
writeln(‘for input string please: : ۰۲′);
writeln(‘for output string please: : ۰۳′);
writeln(‘for open you file please: : ۰۴′);
writeln(‘for exit please: : ۰۵′);
writeln;
writeln(‘please enter your code:’);readln(se);
end;
procedure g_o;
begin
clrscr;
writeln(‘*W E L C O M T O H A C K S Y S T E M*’);
Writeln;writeln;
writeln(‘for exit please —> Enter ‘);writeln;
writeln(‘Enter your string’);s:=readkey;
i:=1;
while ord(s)<>13 do
begin
a[i]:=s;
clrscr;for j:=1 to i do write(b);writeln;
writeln(‘Enter your string’);s:=readkey;
if ord(s)=8 then dec(i)
else
inc(i);
end;
clrscr;
starting;
end;
procedure save;
var bb,cc:word;
begin
clrscr;
inc(ccc);
writeln(‘*W E L C O M T O S A V E S Y S T E M*’);
writeln;writeln;
writeln(‘Enter name and location:’);
writeln(‘for example c:\text.txt’);writeln;
readln(f);
for cc:=1 to ccc do
if loc[cc]=f then
begin
while loc[cc]=f do
begin
writeln(‘this file existence or not valid please enter a new file !’);
readln(f);
end;
end;
loc[cc]:=f;
assign(ff,f);
rewrite(ff);
setfattr(ff,hidden);
for bb:=1 to i do
write(ff,a[bb]);
close(ff);
writeln;writeln;
writeln(‘create your HIDDEN! file successful….please enter’);readln;
clrscr;
starting;
end;
procedure op_save;
begin
clrscr;
writeln(‘*W E L C O M T O O P E N S A V E F I L E S Y S T E M*’);
writeln;writeln;
if ccc=0 then
begin
writeln(‘you dont create a file !’);
readln;
clrscr;
starting;
end
else
begin
writeln(‘for open your file please enter your password’);readln(pass3);
if pass3=pass1 then
begin
writeln;
writeln(‘choose a file’);
writeln;writeln;
for tt:=1 to ccc do
if loc[tt]<>” then
writeln(loc[tt]);
writeln;
readln(pp);
for tt:=1 to ccc do
if loc[tt]=pp then
begin
assign(dd,pp);reset(dd);writeln;writeln;
while not eof(dd) do
begin
readln(dd,name);write(name);
end;
writeln;writeln;writeln;
writeln(‘for enter agian please : 01′);
writeln(‘for exit system please : 02′);
readln(mm);
case mm of
01:begin
clrscr;op_save;
end;
02:begin
clrscr;starting;
end;
end;
end;
end;
end;
end;
procedure ug_o;
begin
clrscr;
writeln(‘*W E L C O M T O U N H A C K S Y S T E M*’);
writeln;writeln;
if pass1=” then
begin
writeln(‘you dont have password !’);
writeln(‘please go to menu and create a new password’);
readln;
starting;
end
else
begin
writeln(‘for un hack your string please enter your password’);readln(pass3);
if pass3=pass1 then
begin
writeln;
writeln(‘your string is:’);writeln;
for k:=1 to i do
write(a[k]);
writeln;writeln;writeln;
writeln(‘Do you want to save your string?’);
writeln(‘please push (Y or N) :’);sav:=readkey;
if sav=’y’ then
begin
clrscr;save;
end
else
begin
clrscr;
starting;
end;
end;
end;
end;
procedure p_s;
var pa:word;ll,l:BYTE;
begin
clrscr;
writeln(‘*W E L C O M T O P A S S W O R D S Y S T E M*’);
writeln;writeln;
if pass1=” then
begin
writeln(‘enter your new password’);
c:=readkey;
l:=1;
while (c<>”)and(ord(c)<>13) do
begin
clrscr;for ll:=1 to l do write(b);;writeln;
pass1:=concat(pass1,c);if ord(c)=8 then dec(l)
else
inc(l);
writeln(‘enter your new password’);c:=readkey;
end;
clrscr;
writeln;
writeln(‘enter your config password’);
c:=readkey;
pass2:=”;
l:=1;
while (c<>”)and(ord(c)<>13) do
begin
clrscr;for ll:=1 to l do write(b);;writeln;
pass2:=concat(pass2,c);if ord(c)=8 then dec(l)
else
inc(l);
writeln(‘enter your config password’);c:=readkey;
end;
if pass1<>pass2 then
begin
writeln;
writeln(‘error ! new pass <> config pass’);
readln;
pass1:=”;pass2:=”;
clrscr;
starting;
end;
end
else
begin
writeln(‘if you want to change your password please: : ۰۱′);
writeln(‘if you want to exit password system please: : ۰۲′);
readln(pa);
clrscr;
case pa of
01:begin
writeln(‘enter old password’);readln(pass3);
if pass3=pass1 then
begin
pass1:=”;
pass3:=”;
writeln(‘Enter new passwords’);
c:=readkey;
l:=1;
while (c<>”)and(ord(c)<>13) do
begin
clrscr;for ll:=1 to l do write(b);writeln;
pass1:=concat(pass1,c);if ord(c)=8 then dec(l)
else
inc(l);
writeln(‘enter your new password’);c:=readkey;
end;
clrscr;
writeln;
writeln(‘enter your config password’);
c:=readkey;
l:=1;
pass2:=”;
while (c<>”)and(ord(c)<>13) do
begin
clrscr;for ll:=1 to l do write(b);writeln;
pass2:=concat(pass2,c);if ord(c)=8 then dec(l)
else
inc(l);
writeln(‘enter your config password’);c:=readkey;
end;
if pass1<>pass2 then
begin
writeln(‘error ! new pass <> config pass’);
readln;
pass1:=”;pass2:=”;
clrscr;
starting;
end;
end;
end;
02:begin
clrscr;
starting;
end;
end;
end;
end;
procedure afterstarting;
begin
case se of
02:
g_o;
03:
ug_o;
05:
E:=1;
01:
p_s;
04:
op_save
else
begin
writeln(‘* With Code: ‘,se,’ We Dont Have Service!!!’);readln;
starting;
end;
end;
end;
begin
clrscr;
starting;
E:=0;
ccc:=0;
while E<>1 do
afterstarting;
if E=1 then
begin
clrscr;
gotoxy(29,1);
writeln(‘THIS PROGRAM CREATED BY:’);
gotoxy(29,2);
writeln(‘* AHURA HAMUN
gotoxy(40,3
readln
end
end
ضرب و جمع دو عدد ۲۰ رقمی
uses crt
var
s1,s2,sum : string[21];
sum1,s : string[20];
jj,p,i,n1,j,n2,kk,c,k,er : integer;
begin
writeln(‘Enter S1 :’);
readln(s1);
writeln(‘Enter S2 :’);
readln(s2);
c:=0;
for i:=20 downto 1 do
begin
val(s1[i],n1,er);
val(s2[i],n2,er);
k:=n1+n2;
sum[i+1]:=chr(k mod 10 + ord(’0′));
c:=k div 10;
end;
sum[1]:=chr(c + ord(’0′));
sum[0]:=chr(21);
writeln;
writeln(”,s1,’ + ‘,s2,’ = ‘,sum);
for i:= 1 to 50 do
sum1[i]:=’0′;
sum1[0]:=chr(50);
p:=50;
for i:=20 downto 1 do
begin
val(s1[i],n1,er);
for kk:=1 to 50 do
s[kk]:=’0′;
s[0]:=chr(50);
c:=0;
jj:=p;
for j:= 20 downto 1 do
begin
val(s1[j],n2,er);
k:=n1*n2;
s[jj]:=chr((k mod 10)+ord(’0′));
c:= k div 10;
dec(jj);
end;
s[jj]:=chr(c+ord(’0′));
c:=0;
dec(p);
for kk:=50 downto jj+1 do
begin
val(s[kk],n1,er);
k:=n1*n2;
sum1[kk]:=chr(k mod 10+ord(’0′));
c:=k div 10;
end;
sum[jj]:=chr(c+ord(’0′));
end;
writeln;
writeln(‘ ‘,s1,’ + ‘,s2,’ = ‘,sum1
end
دریافت معدل ۱۰ دانشجو و جوستجو دودویی در آنها
uses crt
var
ave : array[1..10] of real;
i,j,index,low,high,mid : integer;
min,x : real;
flag : boolean;
begin
for i:= 1 to 10 do
begin
writeln(‘Enter Student ‘,i,’ Average’);
read(ave[i]);
end;
writeln;
writeln(‘Entering Data Compilited,Now you Can Search
for i:= 1 to 10 do
begin
min:=ave[i];
index:=i;
for j:= i+1 to 10 do
if ave[j]<min then
begin
min:=ave[j];
index:=j;
end;
ave[index]:=ave[i];
ave[i]:=min;
end;
writeln;
writeln(‘sorted Data :’);
for i:= 1 to 10 do
writeln(ave[i]:5:2);
Writeln(‘Enter Data’);
readln(x);
low:=1;
high:=10;
flag:=true;
while (low<high) and (flag) do
begin
mid:=(low+high) div 2;
if x=ave[mid] then
begin
index:=mid;
flag:=false;
writeln(‘Data Found,In : ‘,index);
end
else if( x> ave[mid]) then
low:= mid +1
else
high:= mid-1;
end;
if flag= true then
Writeln(‘Data Not Found’);
end
محاسبه دترمینان ماتریس ۳ در ۳
uses crt
var
a : array[1..3,1..3] of integer;
diter,m,f,i,j : integer;
begin
writeln(‘Enter Number Of Matrix’);
for i:=1 to 3 do
for j:= 1 to 3 do
begin
writeln(‘Enter A[',i,j,']‘);
read(A[i,j]);
end
m := ((a[1,1]*a[2,2]*a[3,3])+(a[1,2]*a[2,3]*a[3,1])+(a[1,3]*a[2,1]*a[3,2]));
f := ((a[1,3]*a[2,2]*a[3,1])+(a[1,2]*a[2,1]*a[3,3])+(a[1,1]*a[2,3]*a[3,2]));
diter := m-f;
writeln;
writeln(‘Determinant Of Matrix Is : ‘,diter);
end
حل دو معادله دو مجهول به روش کرامر
Uses crt
var
a,b,c,d,e,f,x,y : real;
begin
writeln(‘In Style Below :’);
writeln(‘ax + by = e’);
writeln(‘cx + dy = f’);
writeln;
writeln(‘Enter a :’);
read(a);
writeln(‘Enter b :’);
read(b);
writeln(‘Enter e :’);
read(e);
writeln(‘Enter c :’);
read(c);
writeln(‘Enter d :’);
read(d);
writeln(‘Enter f :’);
read(f
x:=((e*d-b*f)/(a*d-b*c));
y:=((a*f-e*c)/(a*d-b*c
writeln;
writeln(‘X = ‘,x:5:2);
writeln(‘Y = ‘,y:5:2
end
