Last active
December 17, 2015 07:09
-
-
Save Evshved/72931684b94c46ed0c54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adding_bitmaps | |
uses crt; | |
var A,B,C=array | |
count_mas,count_dig,tip,time_count=variables | |
read(tip); | |
// randomized elements input massives | |
for count_mas:=1 to tip do | |
A[count_mas]:=random(2); | |
B[count_mas]:=random(2); | |
A[tip+1]:=1; | |
B[tip+1]:=1; | |
//show in crt | |
write(' '); | |
for time_count:=tip+1 downto 1 do | |
write(A[time_count]:2); | |
writeln; | |
for time_count:=tip+1 downto 1 do | |
write(B[time_count]:2); | |
count_mas:=0; | |
//adding A and B | |
while count_mas<>(tip+2) do | |
count_mas:=count_mas+1; | |
if (A[count_mas]+B[count_mas]=0) and (count_dig=1) then | |
C[count_mas]:=1; | |
count_dig:=0; | |
continue; | |
if (A[count_mas]+B[count_mas]=2) and (count_dig=0) then | |
C[count_mas]:=0; | |
count_dig:=1; | |
continue; | |
if (A[count_mas]+B[count_mas]=1) and (count_dig=1) then | |
C[count_mas]:=0; | |
count_dig:=1; | |
continue; | |
if (A[count_mas]+B[count_mas]=1) and (count_dig=0) then | |
C[count_mas]:=1; | |
continue; | |
if (A[count_mas]+B[count_mas]=2) and (count_dig=1) then | |
C[count_mas]:=1; | |
count_dig:=1; | |
continue; | |
if (A[count_mas]+B[count_mas]=2) and (count_dig=0) then | |
C[count_mas]:=0; | |
count_dig:=1; | |
continue; | |
//show in crt | |
writeln; | |
for time_count:=tip+2 downto 1 do | |
write(C[time_count]:2); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment