I'm studying for a college programming challenge and my teacher gave some programming exercises to train. The bending machine was proposed, but I am not able to develop the input process, in which the person assigns several values for the machine to perform the processing. If anyone can help me here is the link of the test.
The snippet I'm having is this: "The next line will contain N integers v1, ..., vN, corresponding to the contents of the input tape". The difficulty I have is to manipulate the input data and throw them into a vector, each value being in a position.
The snippet of code I've been able to do so far is this:
#include <stdio.h>
#include <stdlib.h>
main() {
int tamanho =0, i=0;
printf("Qual o tamanho da Fita?\n");
scanf("%i", &tamanho);
char variaveis[tamanho];
printf("Insira os %i numeros", tamanho );
scanf("%i", &variaveis[i]);
// for(i=1; i<=tamanho; i++){
// printf("Insira numero na posicao %i ", i );
// scanf("%i", &variaveis[i]);
// }
for(i = 1; i<=tamanho; i++){
printf("Os valores digitados foram: %i\n", variaveis[i]);
}
return 0;
}
The program will basically work like this: