varable help

hi am writing a program and i am stuck! i want to ask the user how meany products there is and then ask that meany times the prices of the products that they are selling! any info will be grate also how do u do decamals iv tryed var :real; but the change comes out in this long number with 19+ or something at the end! iv tryed to make it to 3 decmals places didednt work i might have forgot how to do this tho! any help on that would help!!

Comments

  • : hi am writing a program and i am stuck! i want to ask the user how meany products there is and then ask that meany times the prices of the products that they are selling! any info will be grate also how do u do decamals iv tryed var :real; but the change comes out in this long number with 19+ or something at the end! iv tryed to make it to 3 decmals places didednt work i might have forgot how to do this tho! any help on that would help!!
    :

    I don't really understand the first part of your question, but the second part would go like this:

    [code]
    program Decimal;
    var
    num1:real;
    begin
    num1:=3.92376410923765;
    write(num1:1:3); (* the ':3' means to the third decimal place *)
    (* the ':1' means one space... *)
    end.
    [/code]

    So this program would print out '3.923'
    HOPE THIS HELPS!
    -JIM


  • : : hi am writing a program and i am stuck! i want to ask the user how meany products there is and then ask that meany times the prices of the products that they are selling! any info will be grate also how do u do decamals iv tryed var :real; but the change comes out in this long number with 19+ or something at the end! iv tryed to make it to 3 decmals places didednt work i might have forgot how to do this tho! any help on that would help!!
    : :
    :
    : I don't really understand the first part of your question, but the second part would go like this:
    :
    : [code]
    : program Decimal;
    : var
    : num1:real;
    : begin
    : num1:=3.92376410923765;
    : write(num1:1:3); (* the ':3' means to the third decimal place *)
    : (* the ':1' means one space... *)
    : end.
    : [/code]
    :
    : So this program would print out '3.923'
    : HOPE THIS HELPS!
    : -JIM
    :
    that helped thanks but not in the program! this it the line that I am stuck on! see what you think!
    Writeln(change: , totalforproducts);
    iv tred
    writeln('Change: ' , totalforproducts:1:1:2);
    which will give me the answer to 2 decamel placeses! but doese not work!



  • : : : hi am writing a program and i am stuck! i want to ask the user how meany products there is and then ask that meany times the prices of the products that they are selling! any info will be grate also how do u do decamals iv tryed var :real; but the change comes out in this long number with 19+ or something at the end! iv tryed to make it to 3 decmals places didednt work i might have forgot how to do this tho! any help on that would help!!
    : : :
    : :
    : : I don't really understand the first part of your question, but the second part would go like this:
    : :
    : : [code]
    : : program Decimal;
    : : var
    : : num1:real;
    : : begin
    : : num1:=3.92376410923765;
    : : write(num1:1:3); (* the ':3' means to the third decimal place *)
    : : (* the ':1' means one space... *)
    : : end.
    : : [/code]
    : :
    : : So this program would print out '3.923'
    : : HOPE THIS HELPS!
    : : -JIM
    : :
    : that helped thanks but not in the program! this it the line that I am stuck on! see what you think!
    : Writeln(change: , totalforproducts);
    : iv tred
    : writeln('Change: ' , totalforproducts:1:1:2);
    : which will give me the answer to 2 decamel placeses! but doese not work!

    You misread his example a little (the number in the variable name probably threw you off...it took me a second to see it too). That should be totalforproducts:1:2
  • : : : : hi am writing a program and i am stuck! i want to ask the user how meany products there is and then ask that meany times the prices of the products that they are selling! any info will be grate also how do u do decamals iv tryed var :real; but the change comes out in this long number with 19+ or something at the end! iv tryed to make it to 3 decmals places didednt work i might have forgot how to do this tho! any help on that would help!!
    : : : :
    : : :
    : : : I don't really understand the first part of your question, but the second part would go like this:
    : : :
    : : : [code]
    : : : program Decimal;
    : : : var
    : : : num1:real;
    : : : begin
    : : : num1:=3.92376410923765;
    : : : write(num1:1:3); (* the ':3' means to the third decimal place *)
    : : : (* the ':1' means one space... *)
    : : : end.
    : : : [/code]
    : : :
    : : : So this program would print out '3.923'
    : : : HOPE THIS HELPS!
    : : : -JIM
    : : :
    : : that helped thanks but not in the program! this it the line that I am stuck on! see what you think!
    : : Writeln(‘change: ’ , totalforproducts);
    : : iv tred
    : : writeln('Change: ' , totalforproducts:1:1:2);
    : : which will give me the answer to 2 decamel placeses! but doese not work!
    :
    : You misread his example a little (the number in the variable name probably threw you off...it took me a second to see it too). That should be totalforproducts:1:2
    :
    thanks alot mate that helped a bunc!!!!!!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories