data compression in c++.
this is a text compression
eg: gggghhnnnmmmmm
would give us: g4h2n3m4

thank you

So what's your question? We are not going to write your program for you. Compression algorithms are much more complex than what you posted. For example you can get free Zlib source code here

no i dont want u to write my program for me thankyou...and this isnt my progrm i had a few people ask me how to do data compression...but i only know how to do image compression and i thought this might be helpful...but maybe not...thankyou

This form of compression is called run-length encoding.
However, it performs quite poorly for most types of data.

Instead, you should look if any substrings already occurred earlier in the text and save a offset/size pair if they have. This is the general idea many popular compression algorithms are based on.