Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using pointers write a function called removeChar that will remove each instance of a specified character from a CString. A CString is defined as an

Using pointers write a function called removeChar that will remove each instance of a specified character from a CString.

A CString is defined as an array of characters that is terminated by the NULL ('\0') character.

Your function should return the number of characters that were removed from the string.

Your function should take as arguments, the CString to remove the characters from, and the character to remove.

Note:

The argument which represents the character to be removed should be a default argument. Meaning that if a character is not provided it will default to the space character (Decimal 32 or Hex 20).

Using the subscript operator [] is not using a pointer.

What not to do

Using any of the following will drop your grade for this assignment by 70%

global variables.

cin in any funciton other than main

cout in any funciton other than main

goto statements

Note:

To get a sentence from the keyboard you must use cin.getline:

char str[100];

cin.getline(str, 99); // save room for the null character.

Your output should look something like the following:

image text in transcribed

C:Windows system32\cmd.exe This is a test i hope it works Enter a character to remove Removed 4 i characters. Your string is now: Ths s a test hope t works Press any key to continue

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Openly acknowledges the value of other peoples ideas and opinions.

Answered: 1 week ago