Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com C++ programm (palindrome using string???)

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 02-24-2005, 06:39 AM PM User | #1 mccormick New to the CF scene   Join Date: Feb 2005 Posts: 2 Thanks: 0 Thanked 0 Times in 0 Posts C++ programm (palindrome using string???) hey guys im a newbie here ... could you help me??? how can u make a palindrome programm where u can input string and the output is palindrome,and not a palindrome??
 02-24-2005, 07:00 AM PM User | #2 jkd Senior Coder     Join Date: May 2002 Location: metro DC Posts: 3,163 Thanks: 1 Thanked 18 Times in 18 Posts Definitely sounds like a CS homework assignment. I did the same thing for APCS back in the day. We're not here to do your homework assignments, if this is the case. __________________ jasonkarldavis.com
 02-24-2005, 07:09 AM PM User | #3 redoc New Coder   Join Date: Jan 2005 Location: Iowa City Posts: 47 Thanks: 0 Thanked 0 Times in 0 Posts well, there are many ways to do it.. first thing that pops into my head is go through the string 1 by 1 and if its a character, make it lowercase, then put it into an array, else skip it. (This will make your program ignore cases, so a=A and ignore punctuation and whitespace). Now that you have an array of all the chars, simply have a for loop go through half the array, and if array[count] doesn't equal array[arrayLength - count] then its not a palindrome. Here is pseudo-code for the last part: Code: ```palindrome = true for i=1 to arrayLength/2 { if array[i] != array[arrayLength-i] { palindrome = false break } } if(palindrom) print "is a palindrome" else print "is not a palindrome"``` __________________ PS - this is what part of the alphabet would look like if Q and R were eliminated.
02-24-2005, 08:01 AM   PM User | #4
Spookster
Supreme Overlord

Join Date: May 2002
Location: Marion, IA USA
Posts: 6,264
Thanks: 4
Thanked 83 Times in 82 Posts
Quote:
 Originally Posted by redoc well, there are many ways to do it.. first thing that pops into my head is go through the string 1 by 1 and if its a character, make it lowercase, then put it into an array, else skip it. (This will make your program ignore cases, so a=A and ignore punctuation and whitespace). Now that you have an array of all the chars, simply have a for loop go through half the array, and if array[count] doesn't equal array[arrayLength - count] then its not a palindrome. Here is pseudo-code for the last part:

Which part of "were not here to do homework assignments" was unclear to you?

I certainly hope you get a good grade on their homework assignment.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster

02-24-2005, 05:04 PM   PM User | #5
New Coder

Join Date: Dec 2004
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by jkd Definitely sounds like a CS homework assignment. I did the same thing for APCS back in the day. We're not here to do your homework assignments, if this is the case.
Agreed!

The Palindrome program is almost as widely used as "Hello World!" among CS students. If you are asking for help with this very basic program you might want to rethink your major.

I still have my palindrome program and it can be done in under 20 lines of code.

Good luck and take your time, it will come to you.

02-24-2005, 08:03 PM   PM User | #6
Spookster
Supreme Overlord

Join Date: May 2002
Location: Marion, IA USA
Posts: 6,264
Thanks: 4
Thanked 83 Times in 82 Posts
Quote:
 Originally Posted by abbeyroadd Agreed! The Palindrome program is almost as widely used as "Hello World!" among CS students. If you are asking for help with this very basic program you might want to rethink your major. I still have my palindrome program and it can be done in under 20 lines of code. Good luck and take your time, it will come to you.
Yes it is a very common programming assignment to teach both the methods of solving problems and coding in a particular language. I got stuck doing it in assembly when I was in college.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster

 02-24-2005, 10:20 PM PM User | #7 Antoniohawk Senior Coder   Join Date: Aug 2002 Location: Kansas City, Kansas Posts: 1,518 Thanks: 0 Thanked 2 Times in 2 Posts I've also just done it in a Java class. As Spookster and JKD have already said, we don't help people with their homework around here. In the future, try to lead them in the right direction so that they can figure it out themselves. __________________ xhtml :: attributes . tags . vs. CSS :: Box Model Hack [CF T-Shirts] [CP Resources] [ithium hosting] [A New Generation of Tree Menu]
02-24-2005, 11:33 PM   PM User | #8
New Coder

Join Date: Dec 2004
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by Antoniohawk In the future, try to lead them in the right direction so that they can figure it out themselves.
I will give him the variables that I started with, even though there a ton of ways to do this here is what I used.

Code:
```#define size 100

char strsrc[size];
char strhld[size];
You could use dynamic memory with this program but I felt that was a waste of time, but if you get it done try to use dynamic memory...it's good practice.

 02-25-2005, 01:25 AM PM User | #9 redoc New Coder   Join Date: Jan 2005 Location: Iowa City Posts: 47 Thanks: 0 Thanked 0 Times in 0 Posts Hey, im here to help whenever I can. I didn't post any code itself (unless psuedo code counts, and i dont think so). I posted an algorithm that could be implemented in any language you want, and a kickstart on how to do it. Perhaps this person is learning on his own using a coursebook from a friend, who knows. Besides, even if he is taking a class, there are millions of ways to cheat, and he is only hurting himself. I am not hurting a person like that because they would find other ways to cheat. Thanks my opinion anyways, I hope people dont have to start listing details of exactly why a question is being asked before it will be answered. I can see it now... My name is X, i work for company Y, my boss does know that I am asking for help online, here is a signed consent form. Now, my question is.... __________________ PS - this is what part of the alphabet would look like if Q and R were eliminated.
02-25-2005, 05:24 AM   PM User | #10
Spookster
Supreme Overlord

Join Date: May 2002
Location: Marion, IA USA
Posts: 6,264
Thanks: 4
Thanked 83 Times in 82 Posts
Quote:
 Originally Posted by redoc Hey, im here to help whenever I can. I didn't post any code itself (unless psuedo code counts, and i dont think so). I posted an algorithm that could be implemented in any language you want, and a kickstart on how to do it. Perhaps this person is learning on his own using a coursebook from a friend, who knows. Besides, even if he is taking a class, there are millions of ways to cheat, and he is only hurting himself. I am not hurting a person like that because they would find other ways to cheat. Thanks my opinion anyways, I hope people dont have to start listing details of exactly why a question is being asked before it will be answered. I can see it now... My name is X, i work for company Y, my boss does know that I am asking for help online, here is a signed consent form. Now, my question is....
Like I said before half of the programming assignments are about solving the logic of the problem and you did that for them. The second part is coding and by giving them such detailed pseudocode you pretty much did the entire assignment for them.

As we are the moderators here we can and will enforce rules as we see fit. We do not condone cheating here at CodingForums period. No if's and's or but's about it. A moderator already stated not to do the homework for them and you basically ignored that and posted it anyways. Some of us have been moderators here for several years so we are very experienced at spotting people trying to get other people to do their homework assignments for them.

If you have a problem with us not allowing cheating here at CodingForums you are more than welcome to take it up with the management.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster

02-27-2005, 01:36 AM   PM User | #11
redoc
New Coder

Join Date: Jan 2005
Location: Iowa City
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by Spookster As we are the moderators here we can and will enforce rules as we see fit. ... If you have a problem with us not allowing cheating here at CodingForums you are more than welcome to take it up with the management.
I have no problems with following the rules, as long as those rules are expressed. I have read the rules of posting, and it did not mention anything about cheating whatsoever. If there is a rule about cheating, I suggest to management that it be placed in the forums Rules so all can be aware of it. Until then, I will answer any questions within my knowledge.
__________________
PS - this is what part of the alphabet would look like if Q and R were eliminated.

02-27-2005, 03:24 AM   PM User | #12
jkd
Senior Coder

Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
Quote:
 Originally Posted by redoc I have read the rules of posting, and it did not mention anything about cheating whatsoever. If there is a rule about cheating, I suggest to management that it be placed in the forums Rules so all can be aware of it. Until then, I will answer any questions within my knowledge.
A quick reality check... shouldn't the act of cheating on an assignment, and thereby violating the university's or school's plagiarism policy (which is enough to often expel a student) itself constitute enough of a reason to refrain from doing so?

This rules of this forum don't dictate the rules of higher academic institutions or even those of simple ethics. There is no forum rule explicitly forbidding hacking CF's vBulletin installation, but you know what? It's just as illegal to do so regardless.

You made a mistake posting the code, oh well. We're not going to hold it against you (at least I won't, and I'll use my supermoderator status to that end), but accept it and move on.
__________________
jasonkarldavis.com

Last edited by jkd; 02-27-2005 at 03:26 AM..

 02-27-2005, 05:48 AM PM User | #13 redoc New Coder   Join Date: Jan 2005 Location: Iowa City Posts: 47 Thanks: 0 Thanked 0 Times in 0 Posts I didn't cheat on anything... I answered somebodies question. I dont know how they used that information... Mccormick may (or may not) have cheated. He did the wrongdoing if he indeed did cheat. I made no mistake in my posting, and will continue to answers peoples questions. If this is a problem, I guess I will be banned. __________________ PS - this is what part of the alphabet would look like if Q and R were eliminated.
 02-28-2005, 02:55 AM PM User | #14 deadimp New Coder   Join Date: Nov 2003 Location: I have no life Posts: 29 Thanks: 0 Thanked 0 Times in 0 Posts I'm not going answer the direct question, but instead, give you some pretty general tips: Code: ```#include char& std::string::operator [](index); bool operator ==(std::string &lhs, std::string &rhs);``` __________________ Come to my site, currently under construction.
02-28-2005, 04:43 AM   PM User | #15
cfc
Regular Coder

Join Date: Dec 2004
Location: Keswick, Ontario
Posts: 251
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by redoc I didn't cheat on anything... I answered somebodies question. I dont know how they used that information... Mccormick may (or may not) have cheated. He did the wrongdoing if he indeed did cheat. I made no mistake in my posting, and will continue to answers peoples questions. If this is a problem, I guess I will be banned.
That's taking too simple of a perspective on giving people answers to homework. If a moderator posts not to help somebody because they identify it as cheating on an assignment, don't help them unless the person asking provides a reasonable excuse. It may not be a rule, but it has been posted by the administrator elsewhere and by the moderators several times. You're not technically helping them with their problem if you're depriving them of the fundamental ability to analyze problems and relate them to code.

Would you have gained your abilities if somebody did all of your coding for you?

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 06:48 PM.