was just wondering if anyone can help me with some homework. I have been trying to figure this out for a couple hours now. I am sure it is probably simple but I can't get it to run. What I have to do is take user input that contains the word HELL, and censor it to HECK. It needs to know that it is the word HELL and not something that contains it like HELLO. Also, we are not allowed to use the header <string>. This is just a small part of the whole homework so it needs to be a function. Thanks for Helping!!

Recommended Answers

All 5 Replies

Look at each character. When you see an H remember it. If the next letter is E, remember it, else forget everything. Continue until you have all the letters. Now check if there is a letter before or after these letters. If so, ignore it all, otherwise, change the characters

Thanks for the reply, but how would I do that. I am kind of new at this.

One way is to call strstr() to see if the string contains " HELL " (notice the spaces within the quotes.

Another way is to
1) read your text book
2) check out some tutorials
3) talk to your instructor
4) try something and see if it works.

We are not a homework service, nor a teaching site. Since your task is very basic, you should have learned the basics in your class and be able to at least do something.

more irritant thing is that what you're asking has less matter with c++ and more with logic, you should really try harder, it's not so complicated

commented: agree +17
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.