The code is copying ALL characters from one string to another and ignoring the copy condition. I know there is an easier way to remove spaces and vowels, which is bringing the next character to the current position, but the code was asked to do so.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Faça um algoritmo que leia uma string e remova as vogais e os espaços em
branco. */
int main(int argc, char *argv[]) {
system ("color 0a");
char str[1000], newstr[1000];
int i = 0;
printf ("Insira uma string:\n");
gets(str);
while (str[i] != '#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Faça um algoritmo que leia uma string e remova as vogais e os espaços em
branco. */
int main(int argc, char *argv[]) {
system ("color 0a");
char str[1000], newstr[1000];
int i = 0;
printf ("Insira uma string:\n");
gets(str);
while (str[i] != '%pre%'){
if (str[i] != 'a'||str[i] != 'e'||str[i] != 'i'||str[i] != 'o'||str[i]
!= 'u'){
newstr[i] = str [i];
}else{
if (str[i] != 'A'|| str[i] != 'E'|| str[i] != 'I'|| str[i] !=
'O'|| str[i] != 'U'){
newstr[i] = str [i];
}else{
if (str[i] != ' '){
newstr[i] = str [i];
}
}
}
i++;
}
printf ("String sem vogais:\n");
puts (newstr);
system ("pause");
return 0;
}
'){
if (str[i] != 'a'||str[i] != 'e'||str[i] != 'i'||str[i] != 'o'||str[i]
!= 'u'){
newstr[i] = str [i];
}else{
if (str[i] != 'A'|| str[i] != 'E'|| str[i] != 'I'|| str[i] !=
'O'|| str[i] != 'U'){
newstr[i] = str [i];
}else{
if (str[i] != ' '){
newstr[i] = str [i];
}
}
}
i++;
}
printf ("String sem vogais:\n");
puts (newstr);
system ("pause");
return 0;
}