unwanted conversion from char to ascii
hi, from this code as input
[source]
char get_op( )
{
char result;
do
{
cout << "Please enter an operator for the expression node: ";
cin >> result;
cout << result << " has been read." << endl;
}while(strchr("+-*/", result) == NULL);
return result;
}
[/source]
to this code as implementation:
[source]
template <class Item>
void expression<Item>::insert_left(const char op, const Item& entry)
{
if(root_ptr == NULL)
{
root_ptr = new exp_tree_node<Item>(op);
root_ptr->set_left(new exp_tree_node<Item>(entry) );
}
}
[/source]
when op is accessed and displayed it shows as ascii and not the intended operator(+-*/) any idea why this is happening??
|