+ 2

What is wrong with this quiz?

I submited quiz in the quiz factory and it was declined. Not even a single line of explanation was given to me about why it is not exepted. This is quiz: " What is output of this code? #include <iostream> #include <set> #include <iterator> using namespace std; int main() { set<char> name; name.insert('S'); name.insert('o'); name.insert('l'); name.insert('o'); name.insert('L'); name.insert('e'); name.insert('a'); name.insert('r'); name.insert('n'); copy(name.begin(), name.end(), ostream_iterator<char>(cout)); return 0; } " and given variants for answer is: - LSaelnor; - 0; - Sn; - SoloLearn; If you copy this code it will compile and run. And will give you output. Correct answer is: LSaelnor. And this answer was marked like correct in the quiz. So why it is declined? Set - is array of elements which sorted in the rise order by compiler automaticly. Because of numbers from ANSI table of characters: 'L'=76,'S'=83,'a'=97,'e'=101,'l'=108,'n'=110,'o'=111,'r'=114 - as you can see numbers in the ascending order. Also <set> not allow to have repetetive elements, this is why only one 'o' was succesfully inserted. So what is wrong?

29th Mar 2018, 7:01 AM
Dmytro Kovryzhenko
Dmytro  Kovryzhenko - avatar
3 Réponses
+ 5
You should consider some things: - The amount of code can be complicated to follow in the given time. - If the content is accessible to others. Even so maybe you can send some lessons on the subject, since you have knowledge about it. In the same way you could try to simplify the quiz. Remember that before being approved they must be evaluated by the community, and if many people do not see it as adequate or feel very complicated the chances of it being approved diminish
29th Mar 2018, 7:21 AM
Mickel
Mickel - avatar
+ 3
@Aaron Erhardt This why this task should be in the factory. For increasing knowledge. Also for another tasks I received decline if similar already exist. And this good but there is not a single task about <set>. And this very useful libriary.
29th Mar 2018, 7:14 AM
Dmytro Kovryzhenko
Dmytro  Kovryzhenko - avatar
0
I guess it's just too specific because even I though I work a lot with c/c++ didn't know the set nor iterator library for I don't often work with strings in that way. (And don't forget that you have limited time for a challenge)
29th Mar 2018, 7:09 AM
Aaron Eberhardt
Aaron Eberhardt - avatar