Good morning!
Using C ++ Dev, I'm doing the following problem in C:
Make a program in C that reads a vector of 20 real-type positions. Change 1st place with 11th, 2nd with 12th, 3rd with 13th, ... 10th with 20th. the modified vector.
This is my code that is 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 not identify the error. What can it be?