better late then never!
I know some C from college (2001-2002), and a bit of C++
I have my own Console program, temperature converter program which originally began as a class assignment in either CS 140 or CS185,
I can't recall if a temperature converter was the assignment and I merely choose the way to write it myself ( I use switches),
or i choose to do a temperature converter....
since then I have worked on a number of times, and as of December 2012 or so... I completed it
i.e. it converts Fahrenheit, Celsius, and Kelvin back and forth
cout << "Please select how You would like to convert.\n" /* Prompts user to make a selection */
<< "Enter the # 1, to convert Fahrenheit to Celsius.\n" /* Prompts user with an option. */
<< "Enter the # 2, to convert Celsius to Fahrenheit.\n" /* Prompts user with an option. */
<< "Enter the # 3, to convert Fahrenheit to Kelvin.\n" /* Prompts user with an option. */
<< "Enter the # 4, to convert Celsius to Kelvin.\n" /* Prompts user with an option. */
<< "Enter the # 5, to convert Kelvin to Fahrenheit.\n" /* Prompts user with an option. */
<< "Enter the # 6, to convert Kelvin to Celsius.\n" /* Prompts user with an option. */
<< "Enter the # 9, to end the program right now.\n" /* Prompts user with an option. */
<< endl; /* Prints new line, and clears cout buffer. */
after completing it I converted it to C++ which really wasn't that hard.. ^_^
and added validation checks to prevent crashing or INFINITE loops
do
{
cout << "Please enter your selection now." /* Prompts for the user's selection. */
<< endl; /* Prints new line, and clears cout buffer. */
cin.clear(); /* Clears input buffer, to avoid garbage. */
cin >> check; /* Gets user's input from the keyboard. */
cin.ignore(); /* Ignores return key stroke. */
cout << endl; /* Prints new line, and clears cout buffer. */
if(cin == NULL) /* Validation of Input buffer, IS NOT NULL. */
{
cout << "\nERROR:\n"
<< "DO NOT ENTER ANY THING OTHER THEN A NUMBER FROM 1 to 6 or 9,\n"
<< "OR THE PROGRAM COULD GO NUTZ...\n"
<< endl;
cin.clear(); /* Clears input buffer to avoid NULL loops. */
cin.ignore(); /* Ignores return key stroke. */
}
}while( (check<1) || (check>6) && !(check==9) ); /* Input selection Validation of check. */
if(check == 9) end(); /* If the User's input is 0, calls end function. */
I am here mainly to bug report when/if i run into anything...