Original Post
How do i (in C++) convert from a char to integer?
example:
input : ''5'' <-- char
output: 5 <-- int
#include <iostream>
using namespace std;
int main( int argc, char *argv[] )
{
char c;
int i;
cout << "Input an integer: ";
cin >> i;
cout << i << endl << "input a character: ";
cin >> c;
cout << c << endl;
}
|
|
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more