programming guys
C++
(win32 console app)
if i had a person input a character, could i have the computer give me a value for the corresponding ASCII number ?
like if they enter "a" can i get the value 97 as an integer?
(win32 console app)
if i had a person input a character, could i have the computer give me a value for the corresponding ASCII number ?
like if they enter "a" can i get the value 97 as an integer?
quick google search...
you might be able to work with it
you might be able to work with it
Code:
// Transform a word into ASCII code
#include <iostream>
using namespace std;
int main()
{
char word[32];
int x = 0;
cout << "Please enter the word (maximum 32 characters):\n";
cin >> word;
cout << "The ASCII for this word is:\n";
while (word[x] != '\0') // While the string isn't at the end...
{
cout << int(word[x]); // Transform the char to int
x++;
}
cout << "\n";
return 0;
}
Originally Posted by janiVI
quick google search...
you might be able to work with it
you might be able to work with it
Code:
// Transform a word into ASCII code
#include <iostream>
using namespace std;
int main()
{
char word[32];
int x = 0;
cout << "Please enter the word (maximum 32 characters):\n";
cin >> word;
cout << "The ASCII for this word is:\n";
while (word[x] != '\0') // While the string isn't at the end...
{
cout << int(word[x]); // Transform the char to int
x++;
}
cout << "\n";
return 0;
}


