Hi guys,
still having a couple of minor issues (by minor I mean...it's not working)
I've got the same code as before, tidied it up a bit and put the var withing the procedures to make them local
Code:
program EX7NOSORT(input,output);
uses crt;
var posi,negi,zero:integer;
heelo & press ret to cont proc
procedure AskNumber;
var numcheck:integer;
begin
writeln('What number/s would you like to check?');
read(numcheck);
begin---------------------added to test
if numcheck>0 then writeln('This is a positive number');
read(posi);---------------------added to test
if numcheck<0 then writeln('This is a negative number');
read(negi);---------------------added to test
if numcheck=0 then writeln('This number is Zero');
read(zero);---------------------added to test
end;
end;
procedure AskTotal;
var count,totnum:integer;
begin
writeln;
writeln('How many numbers will you like to check? ');
readln(totnum);
for count:= 0 to totnum-1 do AskNumber
end;
begin {main program}
hello;
AskTotal;
writeln(posi);---------------------added to test
cont;
{up to 33750}
end.
I tried several variations of read(posi) etc and write and i get nothing, the closest ic ame was when it displayed 3 zero's(when pos & neg were selected) I figure if I can get it to print one then I can work from there.
It seems when I put the read lns in the code doesn't crash but i have to input several numbers and carriage returns before it asks the next number, then repeats until tot numbers has been reached.
I'm a wee bit stuck, I thought by adding a begin / add it might separate the prog but no. I think I might have to ask chief(tutor) for help on this.
It looked so easy to do as well! AGGGH!!!!!
Bookmarks