Soo...I have a question. - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Soo...I have a question.

bmk12345bmk12345 Posts: 7Member
Is it possible to transfer data from an array of integers to a regular integer variable in a specific order?

EX: Say you have an array with numbers 1 2 3 4 5 in each memory slot. I would want to transfer those numbers to a variable, which would have the value of 12,345.

Thank you.

Comments

  • GrieverGriever Posts: 3Member
    I think you need to use the STR function. I think thats the one, but I haven't used it in a while.
  • bmk12345bmk12345 Posts: 7Member
    : I think you need to use the STR function. I think thats the one, but I haven't used it in a while.
    :
    Could you explain that to me?
  • GrieverGriever Posts: 3Member
    well, let me look things over. I'll get back to you later tonight. What version of Pascal are you using.
  • ibyiby Posts: 323Member
    [b][red]This message was edited by iby at 2003-4-1 17:46:32[/red][/b][hr]
    [code]
    var arr:array[1..5] of integer;
    i:integer;
    result:integer;

    begin

    {populate array}
    for i:=1 to 5 do arr[i]:=i;


    {put first array element into result}
    result:=arr[1];

    {combine remining array elements into result}
    for i:=2 to 5 do result=result*10+arr[i];

    {display result}
    writeln('Result is :',result);
    writeln('Press Enter to exit program...');
    readln;
    end.
    [/code]

    hope this helps...
Sign In or Register to comment.