O_oEven if this was an intro to C course, this isn't exactly an amazing example of why C is good. There are much more suited languages to this task.
Really?
*shrug*
No. There is no language more suited to the task when the task is "Learn to solve problems using the C language.".
Yes. Let us imagine that the data had been provided as an XML document.Imagine that if instead of writing a file with | as separators, the data was originally arranged in an XML style format.
Your task is sampling the data for reproduction with adjusted values as from currency conversion.
You are allowed to use any language you like which, for this discussion, is guaranteed to have a "super awesome", either SAX or DOM at your discretion, XML parser.
Depending on the quality of the parser, you may need to write a few dozen lines or several hundred. You may assume you have an XML parser as sophisticated as any as you have had exposure in any language with which you are familiar so as to ease your burden in accomplishing the given task. You, again for discussion, choose to use "Xerces" with the C++ language.
Ready? Go!
*seven seconds passes*
Are you done?
I am done.
I imagined that my data was provided as a relational database living on a "PostgreSQL" instance with tables designed by a seasoned professional who, knowing that one column was a currency value, provided triggers with conversion provided by one of the industry standards.
I'm going to assume that you'll take a little more time yet will accomplish the task.
I accomplished the task, and I didn't even need to look away from my browser.
Wait. We are even having this discussion because we are assuming an academic exercise. The format of the data is not actually relevant to the true task.
Let us now imagine instead that the project was designed as an introduction to using the "Xerces" parsing library with the C++ language making the true purpose of the exercise familiarity with a commonly used tool.
Obviously, I didn't get anything of value from my effort with respect to the purpose of the exercise.
You on the other hand, having successfully employed the library and language to accomplish a task, gained experience solving problems with the tools being covered. You have learned something of processing XML serialized data using the "Xerces" library. You are more familiar with a common tool; you are thus a better candidate for some positions.
If your goal was learning to process data with the "Xerces" library, how silly would it be for me to suggest you just use "PostgreSQL" and add your data to a database? The use of a relational database may even be more suitable for the tasks you have planned, and you could find many here who could advise you about which path to take, but your goal of learning to use "Xerces" can't be accomplished with "PostgreSQL". Similarly, learning to deconstruct an unfamiliar problem by breaking into smaller problems so as a solution may be implemented within the C language can not be accomplished with PHP and XML data.
Soma