November 17th, 2013, 08:06 PM
could you just forward me the codes? please i BADLY need it!
November 17th, 2013, 08:09 PM
int Loop; /*Variable will used for the looping purpose*/
int character_count=0; /*Variable which will pass over each element in the array*/
printf("Enter character sequence:");
if (alphabets[character_count] == alphabets[character_count + 1])
that's all i've been able to do so far.
November 17th, 2013, 10:58 PM
It's at work, but I shouldn't have to give it to you since the translation is so straight-forward.
Why is your attempt so short? Are you trying to rewrite the entire thing from scratch? Whatever for?
Take the original C++ file. Copy it to a C file. Then edit the copied file. Simple, minimal effort. No need to try to make it so much harder than it is.
Copy the file and edit it. Replace bool with the C equivalent (already been discussed to death; were we just waste our time and effort?). Replace all basic string objects with C-style strings. Then replace cout with printf. Then replace cin with appropriate C input functions, such as scanf.
Simple, straight-forward, absolutely no need for any massive rewrite.
It's such a big emergency for you, but you aren't even trying. OK, you have apparently been learning something about C-style strings and I/O, which is a necessary first step. So apply what you've learned! Don't do a massive re-write! Just make a copy to work on and modify only what you need to.
November 18th, 2013, 12:06 AM
#define SIZE 1000
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv)
int countX=0; //iCount[SIZE] is an array for which each index of iCount will hold the number of times each character appeared in your input
//INPUTTING CHARACTERS INTO THE ARRAY
//UNCOMPRESSED SIZE OF ARRAY iCount[SIZE]
for(i=0; iCount[i] !='\0'; ++i);
printf("Total Character= %d\n\n",i);
//ORIGINAL SIZE OF ARRAY USING 8 Bits
Original_Size = i * 8;
printf("Original Size= %d\n",Original_Size);
int y=0; /*Variable which will pass over each element in the array*/
//INSERT BUBBLE SORT HERE
while (iCount[y] != '\0')
if (iCount[y] == iCount[y + 1])
printf("%c%d", iCount[y], index + 1);
index = 0;
//Compression for character array
printf("\n\nTotal Character=%d", countX*2);
math1 = Original_Size-Compression_Size;
math2 = math1/Original_Size;
percentage = math2*100;
well i did it ;) thank you
November 18th, 2013, 01:16 PM
"Code"! Its just "code" not "codes".
Originally Posted by hmmshire
The very first piece of advice you received here was to post code in code tags - why could you not at least have done that!?
Last edited by clifford; November 18th, 2013 at 01:24 PM.