/* * a kisbetűs magánhangzók nagybetűssé konvertálása * 3. verzió: conv_t típus */ #include <iostream> using namespace std ; struct conv_t { 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[] = {{'a','A'},{'e','E'},{'i','I'},{'o','O'},{'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; }