What is the method for getting a string of text and then getting the ascii code for that string?<br><br>ie.<br><br>char test;<br>cin >> test<br>*something*<br>cout << "The ascii code is:" << test
A simple method is assign a char to a int :<br><br>char test;<br>int AsciiOfTest;<br><br>cin >> test<br>AsciiOfTest=(int)test; /* (int) to avoid a warning */<br>cout << "The ascii code is:" << AsciiOfTest; <p>Ferran Casarramona<br><a href=mailto: > </a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.