帮忙改一下错,刚学switch不会指针,看着懵逼
#include <conio.h>#include <stdio.h>
intvv;
void Vs( char* s )
{
for( ; *s; s++ )
/************FOUND**********/
switch( *s );
{case( 'a' ):
case( 'e' ):
case( 'i' ):
case( 'o' ):
case( 'u' ):
vv[ *s - 'a' ]++;
}
}
main()
{
char str, ww = { "aeiou" };
int i;
printf( "\nPlease enter a string:\n" );
gets( str );
Vs( str );
/************FOUND**********/
for( i = 0; i < 6; i++ )
printf( "\n%c ==> %2d", ww, vv[ ww - ww ] );
} 统计英语句子中各小写元音字母出现的次数,大家帮帮忙
#include <stdio.h>
//intvv;
int Vs( char* s,int *a )
{
for( ; *s; s++ )
switch( *s )
{case 'a' :
case 'e' :
case 'i' :
case 'o' :
case 'u' :
a[ *s]++;
}
return a;
}
int main()
{
char str, ww = { "aeiou" };
int i,a={0};
printf( "\nPlease enter a string:\n" );
gets( str );
Vs( str,a );
/************FOUND**********/
for( i = 0; i < 5; i++ )
printf( "\n%c ==> %2d", ww, a[ ww] );
} #include <stdio.h>
//intvv;
int Vs( char* s,int *a )
{
for( ; *s; s++ )
switch( *s )
{case 'a' :
case 'e' :
case 'i' :
case 'o' :
case 'u' :
a[ *s]++;
}
return *a;
}
int main()
{
char str, ww = { "aeiou" };
int i,a={0};
printf( "\nPlease enter a string:\n" );
gets( str );
Vs( str,a );
/************FOUND**********/
for( i = 0; i < 5; i++ )
printf( "\n%c ==> %2d", ww, a[ ww] );
}
二楼老哥代码在我这报错,我小改了一下 看看 {:5_108:} 看看 围观
页:
[1]