-2
Good morning!
Using Dev C++, I am making the following problem in C:
Make a program in C that reads a 20-position vector of the real type. Replace the first position with the 11th, the 2nd with the 12th, the 3rd with the 13th, ..., the 10th with the 20th. the modified vector.
This is my code that’s not working:
#include<stdio.h>
#include<conio.c>
main () {
float vet[20], aux;
int i;
clrscr();
//entrada dos dados
printf("Favor informar 20 valores: ");
for(i=0;i<20;i++) {
gotoxy(i*3+2,8);
scanf("%f", &vet[i]);
}
gotoxy(5,20);
//troca dos vetores
for(i=0;i<20;i++) {
aux=vet[i];
vet[i]=vet[19-i];
vet[19-i]=aux;
}
//saida dos dados
gotoxy(2,12);
printf("Vetor modificado: ");
for(i=0;i<20;i++) {
gotoxy(i*3+2,14);
printf("%i", vet[i]);
}
getch();
}
I can’t identify the error. What can it be?
And what’s the mistake?
– Francisco
I am not being able to change the vectors, when compiling the vector exchange they are: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
– Acetil