Need help (Do it for lulz)

Discussion in 'Scar/Simba Help' started by Xjaa, Jan 7, 2008.

Need help (Do it for lulz)
  1. Unread #1 - Jan 7, 2008 at 8:11 PM
  2. Xjaa
    Joined:
    Jan 21, 2007
    Posts:
    3,248
    Referrals:
    2
    Sythe Gold:
    0
    Lawrence Potamus

    Xjaa Penguin
    $100 USD Donor

    Need help (Do it for lulz)

    Code:
    program CubicCalculator;
    
    var
          l: Integer;
        w: Integer;
      h: Integer;
    k: Boolean;
    begin
    
          l:= 1; //Enter length of cube here
        w:= 2;  //Enter Width of cube here
      h:= 3;   //Enter Height of cube here
    k:= True; //Don't Fuck with this
    if (k = True) then
     begin
    WriteLn('l* w * h');
    
    end;
    end.
    I designed this script to solve the algebraic equation V= l*w*h

    As far as I can tell from looking at it I made an error stating a multiplication, any advice?
     
  3. Unread #2 - Jan 7, 2008 at 8:36 PM
  4. Town
    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5

    Town Grand Master
    Scar Programmers

    Need help (Do it for lulz)

    Code:
    const
            l= 1; //Enter length of cube here
        w= 2;  //Enter Width of cube here
      h= 3;   //Enter Height of cube here
    k= True; //Don't Fuck with this
    begin
    if (k) then WriteLn(IntToStr(l* w * h));
    end.
     
  5. Unread #3 - Jan 7, 2008 at 8:53 PM
  6. Xjaa
    Joined:
    Jan 21, 2007
    Posts:
    3,248
    Referrals:
    2
    Sythe Gold:
    0
    Lawrence Potamus

    Xjaa Penguin
    $100 USD Donor

    Need help (Do it for lulz)

    I am stating as variables because I want to be able to replace the identifiers with other numbers.
    you stated them as constants I believe.
     
  7. Unread #4 - Jan 7, 2008 at 9:07 PM
  8. Town
    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5

    Town Grand Master
    Scar Programmers

    Need help (Do it for lulz)

    You can change that back to how you had it then. Just remember you can't do math with strings.
     
  9. Unread #5 - Jan 7, 2008 at 9:49 PM
  10. Xjaa
    Joined:
    Jan 21, 2007
    Posts:
    3,248
    Referrals:
    2
    Sythe Gold:
    0
    Lawrence Potamus

    Xjaa Penguin
    $100 USD Donor

    Need help (Do it for lulz)

    Code:
    program CubicCalculator;
    
    const
    
          l= 1; //Enter length of cube here
        w= 2;  //Enter Width of cube here
      h= 3;   //Enter Height of cube here
    k= True; //Don't Fuck with this
    begin
    if (k = True) then
     begin
    WriteLn('l * w * h');
    
    end;
    end.

    Alright, here it is with constants, but Instead of getting "6" as the answer I just get "l * w * h" ,

    And I'm not using strings...
     
  11. Unread #6 - Jan 8, 2008 at 5:43 AM
  12. ProphesyOfWolf
    Joined:
    Dec 6, 2007
    Posts:
    85
    Referrals:
    0
    Sythe Gold:
    0

    ProphesyOfWolf Member

    Need help (Do it for lulz)

    You are, though. Anything inside of ' ' will be a string.. You need to turn the result of the algebraic equation into a string, using IntToStr.. For instance.. You'd rewrite
    Code:
    WriteLn('l * w * h');
    to
    Code:
    WriteLn('' +IntToStr(l * w * h));
    By doing '' at the beginning, it's leaving room for text, and the + before IntToStr adds in the string created from the math done by l*w*h. Lemme know if it still gives you problems..

    NOTE: IntToStr (integer to string) turns an integer into a string. Just wanted to point that out to anyone who didn't get that from my examples..
     
  13. Unread #7 - Jan 8, 2008 at 6:19 PM
  14. Xjaa
    Joined:
    Jan 21, 2007
    Posts:
    3,248
    Referrals:
    2
    Sythe Gold:
    0
    Lawrence Potamus

    Xjaa Penguin
    $100 USD Donor

    Need help (Do it for lulz)

    Code:
    program CubicCalculator;
    
    const
    
            Length= 1;  //Enter length of cube here
          Width= 2;   //Enter Width of cube here
       Height= 3;   //Enter Height of cube here
     k= True;     //Don't Fuck with this
    begin
     if (k = True) then
       begin
    
         WriteLn('' +IntToStr(Length * Width * Height));
       end;
    end.
    Invalid number of parameters in script in line 13.
    I am using constants not integers will that matter?
     
  15. Unread #8 - Jan 8, 2008 at 6:32 PM
  16. GMK
    Joined:
    Aug 2, 2007
    Posts:
    395
    Referrals:
    0
    Sythe Gold:
    0

    GMK Forum Addict

    Need help (Do it for lulz)

    put the : back and it will work. i think!
     
  17. Unread #9 - Jan 8, 2008 at 6:33 PM
  18. Town
    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5

    Town Grand Master
    Scar Programmers

    Need help (Do it for lulz)

    Choose a different variable name, Length is the name of a procedure.
     
  19. Unread #10 - Jan 8, 2008 at 8:56 PM
  20. Xjaa
    Joined:
    Jan 21, 2007
    Posts:
    3,248
    Referrals:
    2
    Sythe Gold:
    0
    Lawrence Potamus

    Xjaa Penguin
    $100 USD Donor

    Need help (Do it for lulz)

    That was the problem, thanks guys.
     
< option chooser | i need help >

Users viewing this thread
1 guest


 
 
Adblock breaks this site