GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Aug-2005, 07:08
rio rio is offline
New Member
 
Join Date: Aug 2005
Location: manila
Posts: 11
rio is on a distinguished road

Visual Basic (VB) palindrome program


I am a 3rd year IT student and I was just wondering if anybody could provide me with a Visual Basic source code of a palindrome program using a 1 dimensional array. I've only started studying 4th generation languages so I'm having a hard time. We've mainly been studying C. Any response would really be appreciated. Thank you so much.
  #2  
Old 10-Aug-2005, 06:15
rio rio is offline
New Member
 
Join Date: Aug 2005
Location: manila
Posts: 11
rio is on a distinguished road
I hate to be redundant but can somebody provide me with a VB source code of a palindrome program using a 1d array. My professor says the logic would be to compare the first letter with the last letter and the second letter with the second to the last letter and so on and so forth. I have no problems with the interface, it's the source code that I need help with. I will forever love anyone who will reply....thank a lot.....muahhh!
  #3  
Old 11-Aug-2005, 14:41
Kacyndra's Avatar
Kacyndra Kacyndra is offline
Member
 
Join Date: May 2005
Location: Maryland
Posts: 233
Kacyndra will become famous soon enough
If you know how to code in C, then you already have 80% of the problem done. The logic is the same, it's the functions that are different, and that you can get online.

So just take your palindrome program from C (the logic I mean) and apply different functions to it.
__________________
Xrum!
  #4  
Old 11-Aug-2005, 14:45
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 6,153
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 beholddavekw7x is a splendid one to behold
You could try this:

VB Tutorial

Here are the arrays


Regards,

Dave
  #5  
Old 12-Aug-2005, 00:46
AlanC AlanC is offline
New Member
 
Join Date: Aug 2005
Posts: 2
AlanC is on a distinguished road
I just lashed this up in about five minutes and it seems to work. It needs a command button (Command1) and an edit box (Text1) for the user to enter a word. There's no checking for leading/trailing spaces that might stop it, though that's trivial to add.

I assumed you wanted to check a 1d array to see if the contents were a palindrome.

VB / Visual Basic Code:
Private Sub Command1_Click()
Dim i As Integer
Dim isPalindrome As Boolean

'redimension array to suit the word in the text box
ReDim Word(Len(Text1.Text))

'fill the array
For i = 1 To Len(Text1.Text)
   Word(i) = Mid(Text1.Text, i, 1)
Next

'check for 'palindromitry'
isPalindrome = True
For i = 1 To UBound(Word) / 2
   If Word(i) <> Word((UBound(Word) - i) + 1) Then
      isPalindrome = False
   End If
Next i

'display result
If isPalindrome = True Then
   MsgBox "This word IS a palindrome"
Else
   MsgBox "This word is NOT a palindrome"
End If

End Sub

Nice though it would be to be loved forever, just a 50% share in your degree would be cool. ;-)

Regards,
Alan
  #6  
Old 12-Aug-2005, 01:50
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,435
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
Good Job, AlanC. That A will look good on your school transcript.
__________________

Definition: Politics
Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
  #7  
Old 13-Aug-2005, 05:24
rio rio is offline
New Member
 
Join Date: Aug 2005
Location: manila
Posts: 11
rio is on a distinguished road
Thanks a lot alan, you've really helped me. And I can't believe you did that in 5 minutes, I'm really impressed. Thanks again.
  #8  
Old 13-Aug-2005, 05:27
rio rio is offline
New Member
 
Join Date: Aug 2005
Location: manila
Posts: 11
rio is on a distinguished road
Wow, the links you provided have been really educational....thanks, I wouldnt have been able to find them by myself.

Quote:
Originally Posted by davekw7x
You could try this:

http://www.officecomputertraining.com/vbtutorial/tutpages/

http://www.officecomputertraining.com/vbtutorial/tutpages/page22.asp
  #9  
Old 13-Aug-2005, 05:33
rio rio is offline
New Member
 
Join Date: Aug 2005
Location: manila
Posts: 11
rio is on a distinguished road
I know what you mean....thanks for reading and responding.

Quote:
Originally Posted by Kacyndra
If you know how to code in C, then you already have 80% of the problem done. The logic is the same, it's the functions that are different, and that you can get online.

So just take your palindrome program from C (the logic I mean) and apply different functions to it
 


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
Major newbie problem cynack MS Visual C++ / MFC Forum 1 08-Apr-2007 11:25
BOOKEEPING program, HELP!! yabud C Programming Language 10 17-Nov-2006 03:48
Help needed on visual C++ basic math program xoBeBExo C++ Forum 5 18-Nov-2005 01:52
GIDForums enables New [VB] Visual Basic bbcode. admin .NET Forum 0 01-Oct-2005 13:08
What is "Ambigious symbol" ??*( a compilation error) small_ticket C++ Forum 2 07-Jan-2005 21:10

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:41.


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