Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute Pascal Online

uses crt;
var num, i, check: integer;
numArray: array [1..32767] of integer; //max value: 32766
bestArray: array [1..32767] of integer;
currentArray: array [1..32767] of integer;
f:text;
procedure 
begin
    temp := numArray[first];
    numArray[first] := numArray[second];
    numArray[second] := temp;
end;

procedure bubblesort();
begin
 	for i := 1 to num do 
 	    begin
		    for j := 1 to num - i do
		        begin
			        if (numArray[j] > numArray[j + 1])  then
			            begin
				            Swap(j, j + 1)
			            end;
		        end;
	    end;
end;

{
procedure addNumToArray(n, t: integer); //n: number,  t: target
begin
    for i := num + 1 downto t do Swap(i, i + 1);
    numArray[t] := n;
end;
}

begin
    check := 0;
    assign(f, 'sn.dat');
    reset(f);
    
    //read numbers and arrays of them
    readln(num);
    for i := 1 to num do read(numArray[i]);
    read(addNum);
    close(f);
    
    
end.

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.