![]() |
|
#1
|
|||
|
|||
Palindrome Without Library Functions?Hi I am new to programming and need lots of help since this is my real first time programming. I need to write a palindrome without using a main() or global variables, as well as no library functions. I have to have a ToUpper function that acts like the standard library function toupper (first checking that the given character is a lower case alphabetical character before performing a transformation). Then I need to write a string named ToUpperStr which converts all alphabetical characters of a given string to uppercase. (The function expects the original string and the resulting conversion overwrites the original string. The function returns a pointer of the resulting string). Next I must write a function named ReverseStr which reverses the string front to back. (The function expects the original string and the address to place the resulting string in that order. The function returns a pointer of the resulting string. Assume that the two blocks of memory don't over lap). Next I have to write a function named "CleanStr" which removes all characters which are not alphanumeric. The function expects the following parameters in the folowing order: original string, address to place the resulting string, address to place the length of the resulting string. (The function returns a pointer of the resulting string. Again assume no two blocks overlap). Next I must write a function named IsPalindrome which returns 1 if the given string is a palindrome and 0 if returns false. This function expects the string to be checked. This function must make use of the other functions specified. Also the function should assume that the maximum length of a given string is the #define'd const STRMAXLEN. This const should be defined in my header file as 80. Someother basic rules for this program are that the original string givin in any function should remain unchanged unless specifically stated in the requirments. Keyword const should be used appropriatly in all functions. Thank you very much to whom ever can help me.
|
|
#2
|
||||
|
||||
|
Well, you're stuck before you begin.
Quote:
Start by writing a program that loads the buffer and prints it out. Then, one by one, write each of the functions you specified and in main() write a peice of code that calls the function in a manner that will test it. Print the results. Then as you get these functions finished, rewrite main() to do the final task -- the palindrome. __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#3
|
||||
|
||||
|
Walt's right. You cannot avoid main. Your program will not even compile without it. You'll get a linker error asking you, "where the heck is this function?" Technically, if you're using Windows, you would call it WinMain, but I have no idea why an introductory programming course would have you doing MFC before learning some basic concepts. If this is your first time programming, I think that the difficulty of this program may be too great for you, unless the instructor is providing a lot of assistance.
__________________
-Aaron |
Recent GIDBlog
Writing a book by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please help with functions... | brookeville | C++ Forum | 36 | 05-Nov-2004 01:23 |
| conflict between printf and stdarg.h va functions | mirizar | C Programming Language | 3 | 12-Jul-2004 09:11 |
| Understanding functions | tommy69 | C Programming Language | 15 | 15-Mar-2004 18:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The