Results 1 to 10 of 25

Thread: Help / Advice please...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    sorry, I'm a bit ashamed of the code so far. am a bit lost on it.

    Code:
    var     count,i,totnum,number,numcheck: integer;
                    pos,zero,neg:boolean;
    
    begin {main program}
    
             begin
             
        write('Please type in how many numbers will be input ');
        readln(totnum);
    
             writeln('what numbers will be checked?');
             read(numcheck);
             pos:=numcheck>0;             //boolean variables
             neg:=numcheck<0;
             zero:=numcheck=0;
    
            // for count:= 0 to totnum do
    
            if pos then write('This is a positive number');
            if neg then write('This is a negative number');
            if zero then write('This number is Zero');
    
            cont;
             end;
    
    end.
    
     {        program countspace(input,output);
     var i,lenght,count:integer;
         sentence:string;
    
    
     begin
             write('sentence: ');
             readln(sentence);
    
             for i:=0 to lenght (sentence) do     //Do error??!?!?!?!
             if (sentence[i] = ' ') or (sentence[i] ='.') then
             count:=count+1;
    
             writeln('spaces: ',count);
             readln;         end.   }
    The prog at the bottom is a simple one to read number of spaces but even that wouldn't compile. Simply don't knwo what I'#m doing wrong
    Last edited by stevengreen22; 21-03-2011 at 04:00 PM.

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
  •