FinallyOriginally posted by Sang-drax
I'd like to judge this contest.
Thank you!
FinallyOriginally posted by Sang-drax
I'd like to judge this contest.
Thank you!
Yes, comment the code!Originally posted by Polymorphic OOP
Do comments count?
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Sure, I'll help out with the judging.
Make sure the code is standard. If it doesn't compile on gcc, I'm gonna be ........ed.
this looks like an interesting one... i remember i already did this one a while back for an Array class i made, i worked in a different manner though, plus i have no $$$$ing clue how it works... so im not gonna be able to relax till i figure it out now, THANKS! THANKS A WHOOLLLLEEE BUNCH!! here goes hours of my life.
edit:: this not an entry.
edit:: its all this one confusing little goddamn line....
edit:: i figured it out... and its genuis, i might add.
might i make this post worht something by wishing all the contestants good luck, and the judges too, hehe.
Last edited by no-one; 03-01-2003 at 06:29 PM.
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
Cmon, make it an entry!Originally posted by no-one
this looks like an interesting one... i remember i already did this one a while back for an Array class i made, i worked in a different manner though, plus i have no $$$$ing clue how it works... so im not gonna be able to relax till i figure it out now, THANKS! THANKS A WHOOLLLLEEE BUNCH!! here goes hours of my life.
edit:: this not an entry.
edit:: its all this one confusing little goddamn line....
edit:: i figured it out... and its genuis, i might add.
might i make this post worht something by wishing all the contestants good luck, and the judges too, hehe.
You can try your functions using this test program.
It tests various syntactic constructions and the resulting strings.
Code:int main() { using namespace std; bool correct = true; string s1,s2; //Basic test s2 = "0123456789"; string s3 = Mid(s2,1,4); s1 = Mid(s2,1,4); s2 = Mid("0123456789",1,4); if (s1 != "1234" or s2 != "1234" or s3 != "1234") cout << "Basic test incorrect : " << s1, correct=false; //First test s1 = "abcdefg"; Mid(s1, 3, 0) = "123"; if (s1 != "abc123defg") cout << "First test incorrect : " << s1, correct=false; //Second test s1 = "abcdefg"; s2 = "123"; Mid(s1, 3, s2.size()) = s2; if (s1 != "abc123g") cout << "Second test incorrect : " << s1, correct=false; //Third test s1 = "abc"; s2 = "123"; Mid(s1, 1, 1) = Mid(s2,1); if (s1 != "a23c") cout << "Third test incorrect : " << s1, correct=false; if (correct) cout << "All tests correct!"; }
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
This may provide some ideas:
Moderator Edit
See VB string functions.
Link removed by Hammer - Too close to giving away answers (bad ones at that), imho.
Some ideas? This shows up how to do the whole function, maybe with some changes.
Ahh, and I still think it's possible to do the Mid function with C.
Okay, prove me wrong by doing it. I certainly can't think of any C constuct which would allow you to have a single "function" act in many different ways.Originally posted by Vber
Some ideas? This shows up how to do the whole function, maybe with some changes.
Ahh, and I still think it's possible to do the Mid function with C.
on the link the guy posted here, there was the "mid" function writen in pure C.
and it was crap, trust meOriginally posted by Vber
on the link the guy posted here, there was the "mid" function writen in pure C.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
And you could apply "mid(astring,0,2)=mid(astring(2,1);" on it?Originally posted by Vber
on the link the guy posted here, there was the "mid" function writen in pure C.
--
i'll be entering, I'll have the code in about 20 mins
Hmmph, 4 hours later and no code?
Hmm maybe I'm just retarded (in fact I'd bet on it!), but the main thing preventing me from writing this code is this:
Mid(s1, 3, 0) = "123";
Apparently my C++ knowledge is too limited, because statements like these don't make much sense to me.
Mid takes a string, the start location, and the end (or 0 for the whole thing?), and returns these characters as a string. At least, that's what it does in the "Basic test". In the "First test" and after, statements like above are rampant - what does it mean?? From my knowledge, it would mean "make a string from s1 starting at the 3rd char going to the end, and then replace that string with "123"" which obviously isn't what happens.
So, what am I missing here? Some C++ concept that I haven't learned or have forgotten?