GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Mar-2004, 08:50
dewil dewil is offline
New Member
 
Join Date: Mar 2004
Posts: 2
dewil is on a distinguished road
Unhappy

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  
Old 03-Mar-2004, 11:09
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
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  
Old 03-Mar-2004, 11:18
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
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  
Old 03-Mar-2004, 11:33
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Quote:
Originally Posted by aaroncohn
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].

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  
Old 03-Mar-2004, 11:44
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
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  
Old 03-Mar-2004, 11:47
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,311
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
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  
Old 03-Mar-2004, 17:45
dewil dewil is offline
New Member
 
Join Date: Mar 2004
Posts: 2
dewil is on a distinguished road

:s


user 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:
#include	    <stdio.h>

****something what i do`nt know what it could be...the beginning...declare something like g,b,d,k,p,t i guess...

main()
    {
	    printf("Input the Word: \n");

program code what have to allot characters g,b,d,k,p,t if there are any...
and then 

                 printf("The word without g,b,d,k,p or t is : \n");

    }
Last edited by dsmith : 03-Mar-2004 at 19:47. Reason: Add C syntax highlighting.
  #8  
Old 03-Mar-2004, 19:48
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
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  
Old 03-Mar-2004, 19:48
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,373
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Let's try this. Is this what your program's output should look like:
Code:
Enter some letters: asdfgh Enter a word: apple pple Enter a word: weatherman wetermn Enter a word: fastbadge tbe

In other words, remove the specified characters from any word typed in and display the result?
  #10  
Old 03-Mar-2004, 22:29
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
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 GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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 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

All times are GMT -6. The time now is 15:33.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.