| | |
data compression help!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2008
Posts: 6
Reputation:
Solved Threads: 0
i have to write a code for compression of lines with redundancies. You are supposed to enter a line of code--for example(YES I CAN! YES I CAN! YES I CAN!) and your output should look like this (3YES3I3CAN3!) so the codes job is to count the number of times a word or character appears. i really appreciate the help. thank you very much
Take a look at
strcmp() . "Technological progress is like an axe in the hands of a pathological criminal."
Or in C++, why bother with what one may call 'messy' character arrays, when there is a 'nice' string type at our disposal. Look at the .substr() method of strings. I recommend looking at the first word of the sentence, finding the next instance of that letter, checking for equality with sub strings from the first letter to the second instance of the same and the substring from the second instance plus the distance from the first to the second, etc. Know what I mean? If that fails try for the next instance of the first letter until you pass the mid-way point of the string. Then go to the second letter ... sounds like fun, huh?
Last edited by twomers; Feb 3rd, 2008 at 6:58 pm.
![]() |
Similar Threads
- analog and digital (IT Professionals' Lounge)
- why use c? (C++)
- Excel webpage vs Mozilla bug workaround (Web Browsers)
- Switching from CS to being a Statistician? (IT Professionals' Lounge)
- input data from a file into an Array (C)
- Does random data compress? (Computer Science)
- do u know LZ77 algorithm (C++)
- xp gif weirdness, trying to track the cause (Windows NT / 2000 / XP)
- NetZero..."high speed"? (IT Professionals' Lounge)
Other Threads in the C++ Forum
- Previous Thread: Weird (and doubly irritating) errors
- Next Thread: Need Comments on.....
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock wordfrequency wxwidgets






