/* * a kisbetűs magánhangzók nagybetűssé konvertálása * 4. verzió: conv_t típus + konstruktor */ #include <iostream> using namespace std ; struct conv_t { conv_t( char from, char to) : from_(from), to_(to) { } char from_; char to_; }; char conv(char); int main() { char ch; cin >> noskipws; while( cin >> ch ) { cout << conv(ch); } return 0; } char conv(char ch) { static const conv_t t[] = { conv_t('a','A'), conv_t('e','E'), conv_t('i','I'), conv_t('o','O'), conv_t('u','U') }; for ( unsigned int i = 0; i < sizeof(t)/sizeof(t[0]); ++i) { if ( ch == t[i].from_ ) { return t[i].to_; } } return ch; }