Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the starter code: /* Returns 1 if the argument is a decimal digit (such as '5'), 0 otherwise */ int is_digit(char character) {

image text in transcribed

Here is the starter code:

/* Returns 1 if the argument is a decimal digit (such as '5'), 0 otherwise */ int is_digit(char character) { /* WRITE THIS FUNCTION */ return -1; }

/* Converts uppercase letters to lowercase letters. * If the argument is an uppercase letter, the function returns the * corresponding lowercase letter (e.g., 'D' yields 'd'). Otherwise, the * function returns the argument, unchanged. */ char to_lowercase(char character) { /* WRITE THIS FUNCTION */ return '\0'; }

2 Treating Characters as Numbers Archie replies to your email, assuring you that a new keyboard has been ordered. Meanwhile, he needs you to write some code that will convert uppercase letters to lowercase letters and to indicate whether or not a character is a decimal digit. You realize this is easy work since those actual functions are part of the standard C library with their prototypes in ctype.h. As you get ready to impress your boss with how fast you can write this code by calling those standard functions, the 3 key (which is also used for #) falls off of your keyboard, preventing you from typing #include . Several other number keys fall off soon thereafter (only 0,7, and 9 remain), along with the s key. The f key is looking fragile, so you decide that you had better not type too many if statements (and without the s key, you can't use a switch statement at all). Edit problem2.c so that is_digit() returns 1 if the character is a decimal digit ('0', '1', '2', ...) and 0 otherwise to_lowercase () will return the lowercase version of an uppercase letter ('A', 'B', 'C', ...) but will return the original character if it is not an uppercase letter You may not #include any headers, you may not use any number keys other than the 0, 9, and 7 (which is also used for &) keys, you may not use switch statements, and you may use at most one if statement in each function. Build the executable with the command: make bitslab2-be sure to fix both errors and warnings

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Identify the elements that make up the employee reward package.

Answered: 1 week ago