题解 | #判断是元音还是辅音#

判断是元音还是辅音

https://www.nowcoder.com/practice/7eb4df4d52c44d309081509cf52ecbc4

#include <stdio.h>
int main()
{
	char c = 'B';
	
	char str[] = "AEIOUaeiou";
	while (scanf("%c",&c)!=EOF)
	{
		getchar();
		int i = 0;
		while (str[i])
		{
			if (c == str[i])
			{
			printf("Vowel\n");
			break;
			}
			i++;
		}
		if (str[i] == '\0')
			printf("Consonant\n");
	}
	return 0;
}

全部评论
int is_exsit(char ch, char* str) { int i = 0; while (str[i]) { if (ch == str[i]) return 1; i++; } return 0; } int main() { char c; char str[] = "AEIOUaeiou"; while (scanf("%c", &c) != EOF) { if (is_exsit(c, str)) { printf("Vowel\n"); } else { printf("Consonant\n"); break; } getchar(); } return 0; }
点赞 回复 分享
发布于 2023-10-24 16:43 湖北

相关推荐

昨天 16:00
门头沟学院 Java
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
昨天 14:23
点赞 评论 收藏
分享
真烦好烦真烦:牛友太有实力了
点赞 评论 收藏
分享
自学java狠狠赚一...:骗你点star的,港卵公司,记得把star收回去
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务