Repetition structure within the selection in visualg

-1

Function: Write a program that creates an initially zeroed vector and inserts a value into the vector at an informed position. For example, for the empty vector v = {}, position 4 and value 10, the program must generate v = {, 10}. If the position is 2 and the value 5, the vector will be v = {, 5, 10}. And so on. If the position is occupied, the values must be rearranged, so as to leave the chosen position, free for the insertion of the new value, the vector will remain v = {, 23, 5, 10}. Show the vector after the inserts.

stop < - "s"
for cont 1 to 5 knife
   x [cont] 4) knife
      type ("Enter a position up to 4 that you want to change:")
      read (posi)
   end while
   type ("Enter the value you want to insert in this position:")
   read (value)
   posi2

asked by anonymous 29.10.2018 / 18:57

1 answer

0

PROBLEM SOLVED

to count from 5 to pos2 step-1 knife
cont2 & lt ;-( cont-1)
x [cont]

05.11.2018 / 02:51