Quiz6

docx

School

De Anza College *

*We aren’t endorsed by this school

Course

22

Subject

Computer Science

Date

Apr 3, 2024

Type

docx

Pages

2

Uploaded by ConstableLapwingPerson1381

Report
CptS 121 – Program Design and Development March 1, 2024 Your Name: ___________________________ TA’s Name: ___________________________ ID#: ___________________________ Section #: ___________________________ Take-Home Quiz 6 (15 pts) – Arrays Using Canvas https://canvas.wsu.edu/ , please submit your solution to the correct quiz folder. Your solution should be a .pdf file with the name <your last name>_quiz6.pdf and uploaded. To upload your solution, please navigate to your correct Canvas lab course space. Select the “Assignments” link in the main left menu bar. Navigate to the correct quiz submission folder. Click the “Start Assignment” button. Click the “Upload File” button. Choose the appropriate .pdf file with your solution. Finally, click the “Submit Assignment” button. 1. (6 pts) Write a function called count_digits() that accepts an array of characters and the number of items in the array as parameters, and returns the number of digit characters in the array. For example, if the array contains [‘C’, ‘p’, ‘t’, ‘S’, ‘1’, ‘2’, ‘1’], then the function returns 3. Note: if the array does not contain any digit characters, then the function returns 0. You may use functions in <ctype.h>. Hint: isdigit (). 2. (9 pts) Write a function called remove_whitespace() that accepts an array of characters and the number of items in the array as parameters, removes all whitespace ( ' ' ) characters from the array, and returns the number of whitespace characters removed. For example, if the array contains [ 'C' , 'p' , 't' , 'S' , ' ' , '1' , '2' , '1' , ' ' , 'i' , 's' , ' ' , 'f' , 'u' , 'n' ] , then the function should remove the whitespace characters. The function must remove the whitespace characters by shifting all characters to the right of each whitespace character, left by one spot in the array. This will overwrite the whitespace characters, resulting in: [ 'C' , 'p' , 't' , 'S' , '1' , '2' , '1' , 'i' , 's' , 'f' , 'u' , 'n' ] . In this Instructor: Andrew S. O’Fallon
CptS 121 – Program Design and Development March 1, 2024 Your Name: ___________________________ TA’s Name: ___________________________ ID#: ___________________________ Section #: ___________________________ case, the function returns 3. Note: if the array does not contain any whitespace characters, then the array is unchanged and the function returns 0. Instructor: Andrew S. O’Fallon
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help