Answer to Question #211616 in C++ for Hemambar

Question #211616

Write a program to create a class Name with data member as char array. Write a member

function to erase a particular character from the given input C++ string.


1
Expert's answer
2021-06-30T03:14:47-0400
#include<iostream>
using namespace std;
class Name{
	private:
	char first_name[10]; 
	public:
		
		void erase_character(char h);
};
void Name::erase_character(char h){
char	first_name [10] = "starter";
	{
			for(int i=0; i<10;i++){
				if(h==first_name[i]){
					first_name[i] = 0;
				}
				else{
					cout<<first_name[i];
				}
				
			}
		}
}
int main(){
	Name n;
	n.erase_character('a');
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS