| | |
Interview Challenge (Word Reversal)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
>I decided to approach it, assuming that I knew absolutely nothing about the type of Token ...
Nice. In fact, I'll accept that as a viable solution.
I also would have accepted a recursive solution:
>Which would lead to the question "if not the standard library, what
>library are we to use and where can we find the documentation for it?".
Which would be a good question.
>But you would have to accept a solution using the standard library
>given your stated requirements since they lack mention of
Nope. The point of many of these questions is to figure out exactly what the requirements are before trying to come up with a solution. Vague requirements are very common with clients, and you're basically saying that I (as the client) have to accept your solution as final even if it's your fault that the solution is worthless. How many clients do you think would pay if you tried to pull that?
Nice. In fact, I'll accept that as a viable solution.
I also would have accepted a recursive solution: C++ Syntax (Toggle Plain Text)
#include <iostream> #include <sstream> #include <string> using namespace std; typedef string Token; void push_frame_arg ( Token tok ) { cout<< tok <<'\n'; } bool add_arguments ( istream& tokenizer ) { Token tok; if ( tokenizer>> tok ) { add_arguments ( tokenizer ); push_frame_arg ( tok ); } } int main() { istringstream tokenizer ( "arg1 arg2 arg3" ); Token tok; add_arguments ( tokenizer ); }
>library are we to use and where can we find the documentation for it?".
Which would be a good question.
>But you would have to accept a solution using the standard library
>given your stated requirements since they lack mention of
Nope. The point of many of these questions is to figure out exactly what the requirements are before trying to come up with a solution. Vague requirements are very common with clients, and you're basically saying that I (as the client) have to accept your solution as final even if it's your fault that the solution is worthless. How many clients do you think would pay if you tried to pull that?
New members chased away this month: 4
•
•
•
•
>But you would have to accept a solution using the standard library
>given your stated requirements since they lack mention of
Nope. The point of many of these questions is to figure out exactly what the requirements are before trying to come up with a solution. Vague requirements are very common with clients, and you're basically saying that I (as the client) have to accept your solution as final even if it's your fault that the solution is worthless. How many clients do you think would pay if you tried to pull that?
¿umop apisdn upside down? Says the net and just like father Christmas and Bill Clinton, the net never lies.
*Voted best profile in the world*
![]() |
Other Threads in the C++ Forum
- Previous Thread: ordered Linked List Copy function
- Next Thread: the middle character of a string
Views: 9511 | Replies: 62
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






