The answer is no, as you've experienced. No matter of begging or complaining will change that.
If someone steals your code, then you are not at fault; (s)he is.
Your problem and code will help contribute to people having the same problem so they can fix it too.
Yes but only a few lines of it is the concerned part and it's enough to help people, indeed I'd willingly leave them here. But I think I must have the right to delete the unconcerned part of the code, since it's got nothing to do with the problem and just remain open to the cheaters. Anyway, it's good to see at least one person like you who has some values.
you've already admitted that your code is wrong. knowing this, why would anyone steal it? this is a public forum. everything here is searchable on Google. in fact, I have found threads that I submitted here minutes later in google results. you should be less concerned about your classmates stealing your code, and more concerned with getting it right.
I'm already more concerned about it that's why I've finished it before posting now here. Btw, the code here is wrong but anyone who know C++ better than me can take and correct it.