1
I’m studying for a programming challenge at College and my teacher gave some programming exercises to train. It was proposed the folding machine, but I am not able to develop the input process, in which the person assigns various values for the machine to perform the processing. If anyone can help me here’s the link of the test.
The section I’m having difficulty with is this: "The next line will contain N integers v1, . . . , vn , corresponding to the content of the input tape". The difficulty I have is to manipulate the input data and throw it into a vector, each value being in a position.
The excerpt of the code that 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:
Thank you for the help Rune, I did the Lasso to ask for numbers individually, but I think it would come out of the proposed, I would need the second option you mentioned. I will test soon less, and mark here your question as accepted or not Ok. thanks
– Fabio Souza