I'll admit to doing someone's homework once. I didn't want to at first, but then I enjoyed it. Here is the story:
He said, "I have these three assignments due, and I can't do them on my own, can you do some for me so I will pass?" And I said, "Why did they give you more than is reasonable to complete?" And he said, "Well, I didn't do the assignments, and so now they are late, but I talked to the instructor and she said if I got them done, I won't be penalized, so how many will you do for me?" And I said, "I would rather that you did them, and I will help you (alot) to get them into form that will get you full credit." And he said, "Like I said, I don't really have time to do them, and anyway I have to study for this other class, because I didn't go to class for two weeks and..." So I say, "Fine, give me one of the programs, I'll write it tonight." And he says, "That's so cool, thanks, I'll buy you a beer next week." So he's taking a C++ 101 course, and it's some simple program like reading from a file, calculating averages of student grades, and then writing it back out to an output file. I decide to use std::copy to read the file in to a std::vector, and I think std::transform to compute averages and write it back out to some ostream object. Because I figured that was probably how they learned in class, if you know what I mean. And also, maybe because I wrote it real fast, but I had this bad habit of doing curly braces like this:
But the program was very short, and it worked, so I fired it back to my friend via e-mail. And a week later he bought me a beer, and was very appreciative of what I had done.Code:if (error) {cout<<"There was an error<<endl;}
And FWIW, he ended up not getting credit for the assignment, although the instructor I think gave him an opportunity to come to her office to explain the code, which he declined. And he switched to be an IS major, which is supposed to be easier than CS, after all.