Please fill in the blanks for C /*This task creates a program that reads 3 lowercase strings and prints them back with uppercase Scan and print the strings using a function Call a function to convert all the letter to uppercase                         If they are already uppercase or non-character (symbol), do nothing                         Otherwise, convert them to uppercase using the ascii table (We can convert the letters right after getting the inputs, but I want to separate them to make the each function shorter and easier to debug). */   #include #__1__ length 1000 //set a maximum length for our character string   /*This function reads in characters from user, and stop when it detects an Enter. Save user input to a string*/ __2__ getString(__3__ str[]) //we don't need to specify size, use '\n' to check when input is done {             printf("\nEnter your string: ");             int index = __4__; //array location initialization             char curChar;             do             {                         curChar = __5__(); // call the function to get 1 character                         __6__[__7__] = __8__; //save the read-in character to the string (character array)                         index++; //update index for next character             }while(curChar __9__ __10__); //the condition, loop runs as long as this happens.                         str[__11__ - __12__] = __13__; // need to add this at the end the string at last index. }   /*This function converts lowercase letters to uppercase     and leave the rest of the characters the same.   Loop through the entire array until the end of the string has been reached*/ __14__ toUpper(__15__ str[]) {             int index = __16__; //array location initialization             while(__17__[__18__] __19__ __20__) //condition to make loop runs: till reaches the end of the string             {                         //check if array character is a lower case                         if((__21__[__22__] >= __23__) __24__ (__25__[__26__] <= __27__))                                     str[index] -= __28__; // convert from lowercase letter to an uppercase letter                         index++; //update to go to next letter             } }   /*This function prints the upper case string*/ __29__ printString(__30__ str[]) {             printf("\nYour string in all CAPS is:\n");             printf("__31__", __32__); }   int main() {             // Use a loop to get 3 strings             for(int i = 0; i < 3; i++)             {                         char str[length];//create a string                         getString(str);//get the string inputted from user                         toUpper(str); //convert string to upper case                         printString(str); //print string             }             return

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please fill in the blanks for C

/*This task creates a program that reads 3 lowercase strings and prints them back with uppercase

  • Scan and print the strings using a function
  • Call a function to convert all the letter to uppercase

                        If they are already uppercase or non-character (symbol), do nothing

                        Otherwise, convert them to uppercase using the ascii table

(We can convert the letters right after getting the inputs,

but I want to separate them to make the each function shorter and easier to debug).

*/

 

#include<stdio.h>

#__1__ length 1000 //set a maximum length for our character string

 

/*This function reads in characters from user, and stop when it detects an Enter.

Save user input to a string*/

__2__ getString(__3__ str[]) //we don't need to specify size, use '\n' to check when input is done

{

            printf("\nEnter your string: ");

            int index = __4__; //array location initialization

            char curChar;

            do

            {

                        curChar = __5__(); // call the function to get 1 character

                        __6__[__7__] = __8__; //save the read-in character to the string (character array)

                        index++; //update index for next character

            }while(curChar __9__ __10__); //the condition, loop runs as long as this happens.

           

            str[__11__ - __12__] = __13__; // need to add this at the end the string at last index.

}

 

/*This function converts lowercase letters to uppercase

    and leave the rest of the characters the same.

  Loop through the entire array until the end of the string has been reached*/

__14__ toUpper(__15__ str[])

{

            int index = __16__; //array location initialization

            while(__17__[__18__] __19__ __20__) //condition to make loop runs: till reaches the end of the string

            {

                        //check if array character is a lower case

                        if((__21__[__22__] >= __23__) __24__ (__25__[__26__] <= __27__))

                                    str[index] -= __28__; // convert from lowercase letter to an uppercase letter

                        index++; //update to go to next letter

            }

}

 

/*This function prints the upper case string*/

__29__ printString(__30__ str[])

{

            printf("\nYour string in all CAPS is:\n");

            printf("__31__", __32__);

}

 

int main()

{

            // Use a loop to get 3 strings

            for(int i = 0; i < 3; i++)

            {

                        char str[length];//create a string

                        getString(str);//get the string inputted from user

                        toUpper(str); //convert string to upper case

                        printString(str); //print string

            }

            return 0;

}

 

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education