Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 5th, 2007, 03:07 AM
Registered User
 
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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??
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Big challenge here! How to convert char* to char^? samiswt Visual C++ 2005 1 November 30th, 2007 09:09 PM
Unwanted Char - OnKeypress event needelp Access VBA 3 December 19th, 2006 07:29 PM
Invalid conversion from 'char*' to 'char' deuxmio C++ Programming 3 December 8th, 2006 07:56 AM
conversion of ascii to char abhi_web C# 1 August 23rd, 2006 09:41 AM
ASCII conversion loop difficulty crmpicco Excel VBA 2 May 3rd, 2005 01:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.