Home > Back-end >  Small white primer for problem solving (extraction) vowels, don't know where is wrong, ask answ
Small white primer for problem solving (extraction) vowels, don't know where is wrong, ask answ

Time:10-05

#include
#include
Void letter (char x [20], char y [20])
{
Int n=strlen (x);
Int j;
For (int I=0, j=0; iIf (x [I]=='a' | | x [I]=='e' | | x [I]=='I' | | x [I]=='o' | | x [I]=='u' | | x [I]=='a' | | x [I]=='e' | | x [I]=='I' | | x [I]=='o' | | x [I]=='u') {
Y=x [j] [I];
j++;
}
}
int main () {
[20] char a, b [20].
Gets (a);
The letter (a, b);
Puts (b);
return 0;
}

11 of 13 C: \ Users \ Administrator \ \ Desktop \ \ C 2.6 vowels 2. CPP [Error] a function - definition is not allowed here before '{' token
1 C: \ Users \ \ Administrator \ \ Desktop \ \ C 2.6 vowels 2. CPP [Error] expected '} 'at the end of the input

CodePudding user response:

Curly braces to pairs, suggesting less} it is clear that the code to play good, you will find a less}, patch is,
 
Void letter (char x [20], char y [20])
{
Int n=strlen (x);
Int j;
For (int I=0, j=0; i{
If (x [I]=='a' | | x [I]=='e' | | x [I]=='I' | | x [I]=='o' | | x [I]=='u' | | x [I]=='a' | | x [I]=='e' | | x [I]=='I' | | x [I]=='o' | | x [I]=='u')
{
Y=x [j] [I];
j++;
}
}

See a less}

CodePudding user response:

#include
#include
Void letter (char x [20], char y [20])
{
Int n=strlen (x);
int i, j;
For ( I=0, j=0 ; iIf (x [I]=='a' | | x [I]=='e' | | x [I]=='I' | | x [I]=='o' | | x [I]=='u' | | x [I]=='a' | | x [I]=='e' | | x [I]=='I' | | x [I]=='o' | | x [I]=='u') {
Y=x [j] [I];
j++;
}
}
y [j]='\ 0';
}
int main () {
[20] char a, b [20].
Gets (a);
The letter (a, b);
Puts (b);
return 0;
}
In addition to the letter function is missing a curly braces outside does not match the
For ( int I=0, j=0 ; Here will take j as redefining the local variable
Y array finally don't forget to the end of the string with 0, otherwise the main function of the puts (b) maybe output
  • Related