题解 AT2156 【居合を終え、青い絵を覆う / UOIAUAI】
因为我想发题解,所以我用了一种与众不同的解法,用Ascll码表来进行,并且要注意文件头要打
include <cstring>
和
include <string>
打表
关于Ascll的知识
a的Ascll码是97
e的Ascll码是101
i的Ascll码是105
o的Ascll码是111
u的Ascll码是117
Ascll码表:
所以,我们可以判断ch的Ascii码是否等于97或101或105或111或117,如果是则输出 vowel,不是则输出consonant。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
char ch;
int main()
{
cin>>ch; if(int(ch)==97||int(ch)==101||int(ch)==105||int(ch)==111||int(ch)==117){cout<<"vowel\n";}
else{cout<<"consonant\n";}
return 0;
}