Results 1 to 10 of 25

Thread: Help / Advice please...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    tried...

    I tried what you suggested and I did have some success but...still more questions...

    Code:
    begin
            writeln('What number/s would you like to check?');
            read(numcheck);
           
    posi:=0;negi:=0;zero:=0
            if  numcheck>0 then writeln('This is a positive number');
            read(posi);
            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;
    Couple of problems that I can't seem to navigate, I've tried several
    options.when i have the read statements after each line it forces me
    to press a number a certain number of times before asking for the next
    number. for example, if i say the first number to check is 5, i thne
    have to input a number 5 times before moving on to the next one.
    I can eliminate this by commenting out the other read lines as above.
    although it stills asks for another number at the end of the statement
    before moving on. this is minor though I guess.
    I've tried variations of:
    Code:
    posi:=0;negi:=0;zero:=0
            if  numcheck>0 then writeln('This is a positive number');
            read(posi);posit:=posi;
    
    -----------------
    posi:=0;negi:=0;zero:=0
            if  numcheck>0 then writeln('This is a positive number');
            read(posi);posit:=posi+1;
    ------------------------
    also tried it in the writlen at the end of the prog, tried to group
    together as well. I think there is just something fundamentally wrong
    that I'm not understanding. I'm also now thinking that the read is
    not doing as I want. It needs to count the number of posi that are
    entered but I get mixed results, on one test it did and on another it
    simply output the number that i entered.

    Hair pulling time.

    as a side note....you guys could bang this out in a couple of minutes...I
    have a tendency to make things more complicated for myself. Is this a
    difficult task or am I a fking idiot

  2. #2
    SOLVED IT!!!!!!!!!!

    all was right but i had the initisling bit at the start of the loop, every time it repeated it reset to zero!!!! sorted!!!!! THANKYOU!!!!

  3. #3
    Quote Originally Posted by stevengreen22 View Post
    as a side note....you guys could bang this out in a couple of minutes... I have a tendency to make things more complicated for myself. Is this a
    difficult task or am I a fking idiot
    No, it is not a difficult task, but that certainly doesn't make you an idiot.

    The reason why it is difficult for you is because you appear to do two things at once.
    1) learning how to program in general, the principles.
    2) learning pascal.

    While you can do both it is much harder than when you only have to do the 2nd. The first however is the most important. Do that one right and you can apply it to any language.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •