Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 5th, 2007, 03:07 AM
Registered User
 
Join Date: Jul 2007
Location: Smithfield, Queensland, Australia.
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
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:35 AM.


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