It looks like you're new here. If you want to get involved, click one of these buttons!
Hello, i have to make this program, but i still haven't finished it and i need some help. This is what i have to do. Make a program in Pascal that after has read a text with a list of nums., it will return the numb. of the nums that appear less than one times in the text.
The text that will be read from the program should be like that.
In the first line there are two nums. seperated by a space, n and m. N is the number of nums that exist, like if the text contains the numbers 1,2,3,4, n is 4 (1..n). M is how many lines follow. Every line has a couple of nums, a,b, (1=<a=<n), (1=<b=<n) (a<>b) a and b are separated by a space.
The file that the program will make will have written on it a num., that says how many nyms are appeared less than two tims in the text.
All the nums. are Integer.
i've made the following program, but it only reads the first line of the text. Anyone that can help me? The deadline is almost ended. Thanks in advance. My code is the following. Program thefinalp;
Var f:Text; m,d:Integer; n:Char; c:String;
a,e:array of integer; LowArr:Integer; HighArr:Integer; ArrayLen:Integer; i:Integer;
begin Assign(f,'finalp.txt'); Reset(f);
repeat Read (f,n); Write(n); until (n=' ');
while not SeekEoln(f) do begin read(f,d); Write(d); End; Readln; Writeln;
setlength(a,m); LowArr:=Low(a); HighArr:=High(a); ArrayLen:=Length(a);
setlength(e,m); LowArr:=Low(e); HighArr:=High(e); ArrayLen:=Length(e);
for i:= LowArr to HighArr do
repeat Read (f,a[i]); Write(a[i]); until (n=' ');
while not SeekEoln(f) do begin read(f,e[i]); Write(e[i]); End; Readln; Writeln;
End; Readln; End.
I've made the code after that, the program is how to put into variables all the nums. I'm a beginner so if anyone could give me an example, would help a lot.
domes.in domes.out 6 7 2 2 4 4 1 3 5 4 3 1 3