/*
* hello.c
*
* print "Hello World!" on standard output device (console).
*
*/
#include <stdio.h>
void toUpperCase(char *p);
void toLowerCase(char *p);
int main()
{
char mes1[] = "Hello";
char mes2[] = "World!";
toUpperCase(mes1);
toLowerCase(mes2);
printf("%s %s\n", mes1
, mes2
);
return 0;
}
void toUpperCase(char *p)
{
while (*p != '\0') {
if (('a' <= *p) && (*p <= 'z')) {
*p += 'A' - 'a';
}
p++;
}
}
void toLowerCase(char *p)
{
while (*p != '\0') {
if (('A' <= *p) && (*p <= 'Z')) {
*p += 'a' - 'A';
}
p++;
}
}
LyogCiAqIGhlbGxvLmMKICogCiAqIHByaW50ICJIZWxsbyBXb3JsZCEiIG9uIHN0YW5kYXJkIG91dHB1dCBkZXZpY2UgKGNvbnNvbGUpLgogKiAKICovCgojaW5jbHVkZSA8c3RkaW8uaD4KCnZvaWQgdG9VcHBlckNhc2UoY2hhciAqcCk7CnZvaWQgdG9Mb3dlckNhc2UoY2hhciAqcCk7CgppbnQgbWFpbigpCnsKICAgIGNoYXIgbWVzMVtdID0gIkhlbGxvIjsKICAgIGNoYXIgbWVzMltdID0gIldvcmxkISI7CiAgICAKICAgIHRvVXBwZXJDYXNlKG1lczEpOwogICAgdG9Mb3dlckNhc2UobWVzMik7CiAgICAKICAgIHByaW50ZigiJXMgJXNcbiIsIG1lczEsIG1lczIpOwogICAgCiAgICByZXR1cm4gMDsKfQoKdm9pZCB0b1VwcGVyQ2FzZShjaGFyICpwKQp7CiAgICB3aGlsZSAoKnAgIT0gJ1wwJykgewogICAgICAgIGlmICgoJ2EnIDw9ICpwKSAmJiAoKnAgPD0gJ3onKSkgewogICAgICAgICAgICAqcCArPSAnQScgLSAnYSc7CiAgICAgICAgfQogICAgICAgIHArKzsKICAgIH0KfQoKdm9pZCB0b0xvd2VyQ2FzZShjaGFyICpwKQp7CiAgICB3aGlsZSAoKnAgIT0gJ1wwJykgewogICAgICAgIGlmICgoJ0EnIDw9ICpwKSAmJiAoKnAgPD0gJ1onKSkgewogICAgICAgICAgICAqcCArPSAnYScgLSAnQSc7CiAgICAgICAgfQogICAgICAgIHArKzsKICAgIH0KfQo=