![]() |
|
#1
|
|||
|
|||
I need programming help...program have to allot characters(k,p,t,g,b,d) from word
Example: if I input "booring" then program give "oorin" Please help me |
|
#2
|
||||
|
||||
|
Hi dewil. Welcome to GIDForums.
It would help if you could post some more details about what your program is supposed to do. For example, does the user type in a word and then the program just displays that word sans the mentioned charecters? Also, if this is a homework assignment (which I suspect it is), you probably won't get anyone here to write this program for you. We would love to help you, but you need to post some code or more specific problems that you may be having with this assignment. Cheers, d |
|
#3
|
||||
|
||||
|
It seems like you probably don't have any code written because you don't know where to start. If that's the case, then this general tip may help you. Break down the problem into a sequence of small steps. Decide what has to be done and design a path to get there using simple logic. For example, if you wanted to get the first and last letter out of a word input by the user, then you would need to take the following steps to do it.
1. Prompt the user for input 2. Retrieve the input given by the user 3. Take the first letter out of the word 4. Take out the last letter of the word 5. Display the result on the screen. As you can see, I didn't phrase the entire problem into one sentence, because you'd be looking at the entire problem all at the same time. Really what you want to do is break your large problem into a bunch of smaller problems that you can solve more easily. Hint: The first letter of a string is usually string[0], and the location of the last letter usually is the same value as the length of the string (when using the string type). If you're using a standard Cstring, then the last letter is the same as the length of the string minus 1, and with AnsiString, the first letter is String[1] instead of string[0]. |
|
#4
|
||||
|
||||
|
Quote:
From reading the description, this doesn't seem to be the intent of his assignment. He doesn't just delete the first and last letters, he deletes the letters that he has specified. In his sample word, it just happened to be the first and last letters. At least that is my take on it. |
|
#5
|
||||
|
||||
|
Ohhh I think you're right. In that case he would have to write a search algorithm that goes through the array and checks to see if the character is there, then if it is, delete it. That would make more sense : )
|
|
#6
|
|||
|
|||
|
Gee, it's kind of difficult to help someone find an answer when we
have to guess what the question is. State the problem, and show what you have done so far. I'll bet that someone here can help! Regards Dave |
|
#7
|
|||
|
|||
:suser just tipe anykind of word....and program just allot characters if there are any g,b,d,k,p,t....i really do`nt know where to start...
ok the code... CPP / C++ / C Code:
Last edited by dsmith : 03-Mar-2004 at 19:47.
Reason: Add C syntax highlighting.
|
|
#8
|
||||
|
||||
|
Okay... I understand what you want to do. I think it would be easiest to have the user input their word into a string, then use its member function, find(), to look for each character. I would elaborate, but I have to go to my UNIX class! Suck :-(
|
|
#9
|
||||
|
||||
|
Let's try this. Is this what your program's output should look like:
Code:
In other words, remove the specified characters from any word typed in and display the result? |
|
#10
|
||||
|
||||
|
I believe he has a static set of letters dictated to him by an instructor or a book, and the program removes those letters from any word input by the user and returns the result, or leaves it alone if the letters aren't in the word.
|
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| some Great site for programming issues | priyanka | Web Design Forum | 8 | 19-Dec-2005 08:55 |
| C programming help!!! | sanman10535 | C Programming Language | 4 | 27-Feb-2004 16:53 |
| question of practice | magiccreative | CPP / C++ Forum | 1 | 06-Feb-2004 07:17 |
| Web and Flash design. PHP, MySQL, ASP, JSP programming. | artem | Web Design Forum | 4 | 28-Apr-2002 04:36 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The