/*------------------------------------------------------------------------------ * File: problem2.c * Function: Change lowercase letters to uppercase letters * Description: This C program changes the message “Welcome to CPE 325 in Fall 2021!” to * "WELCOME TO CPE 325 IN FALL 2021!" * Input: None * Output: "WELCOME TO CPE 325 IN FALL 2021!" * Author(s): Noah Woodlee * Lab Section: 09 * Date: Aug 20, 2021 *----------------------------------------------------------------------------*/ #include #include #include int main(){ int i; char msg[] ="Welcome to CPE 325 in Fall 2021!"; size_t size = sizeof(msg)/sizeof(msg[0]); // size of msg[] for (i=0; i < size;i++){ // loop over the array char str = msg[i]; // store the character in msg[i] as a char in str int str_as_int=(int)str; // covert string to an integer // check if str is lower-case if (islower(str)){ msg[i]=str_as_int-32; // if it is, subtract 32 from the character value } else msg[i]=str_as_int; //else keep the string the same } printf("%s\n",msg); // print output }