the title says it all.. if any1 happen to see one , can post the link to me?
thanx!! i need it to do my assignment .. but i cant find any program as long as that! tq!
my assignment task is to find a program written by other ppl ... and modify it to our own understanding.. hand in both program .. then write a summary about everything i've learnt from the program..
thanx again!

I'll give you one thing, you've got more front than Myers (substitute 'Myers' for any major department store in your area) but maybe that's just me being cynical.

What type of program are you looking for?

For somebody completely new to C++ (as you mention here this particular assignment seems rather advanced. I would have thought for at least the first few classes you'd be learning data types, conditions, branching, functions, classes before debugging another's code.

Now there is a program that could badly use a tune up. Look at the 4 duplicated constructors and the funky iterator names iiii, jjjj FTW. Anyways, the copy constructor is duplicated as there is both a pngwriter &pngwriter::pngwriter( pngwriter &other ) and an overloaded assignment operator. Not only that the copy constructors are leaking memory badly.

The original author uses both new and malloc(). I'm not kidding.

Also the resize() method method is very slow b/c of the use of float. Peel your eyeballs at this:

int tempindex;
   for(int hhh = 0; hhh<width_;hhh++)
	for(int vhhh = 0; vhhh<height_;vhhh++)
	     //graph_[vhhh][6*hhh + i] where i goes from 0 to 5
	     tempindex = 6*hhh;
	     graph_[vhhh][tempindex] = (char) floor(((double)backgroundcolour_)/256);
	     graph_[vhhh][tempindex+1] = (char)(backgroundcolour_%256);
	     graph_[vhhh][tempindex+2] = (char) floor(((double)backgroundcolour_)/256);
	     graph_[vhhh][tempindex+3] = (char)(backgroundcolour_%256);
	     graph_[vhhh][tempindex+4] = (char) floor(((double)backgroundcolour_)/256);
	     graph_[vhhh][tempindex+5] = (char)(backgroundcolour_%256);

This could be easily fixed with

graph_[vhhh][tempindex] = backgroundcolour_ >> 8
	     graph_[vhhh][tempindex+1] = char(backgroundcolour_);

I used this lib and ended up having to fix some of these issues. The problem is huge however. A massive refactoring of this wonderful library is in order. I mean the code duplication alone is like 1000 lines :)

So ya, have at it. Post the fixed code when you are done. I for one will be grateful, and I'm sure other users of pngwriter will too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.