+ 1
Can Anyone Make An Alpha Numeric Converter?But With A Twist!
We Know That Alpha Numeric Converter Are Of Two Types I.e,1]Input Letter A and get 1 in return ;Though This Is Easy, But Im Confused On How To Make The Opposite I.e,the 2nd One]Input Number 1 and get A.Can Anyone Help Me With That?Please In c++.
5 odpowiedzi
+ 5
Alternatively you can also convert the input into its alphabetical representation by using ASCII code.
#include <iostream>
int main()
{
int num;
// Read on until no more input
while(std::cin >> num)
{
// Only accept a range of 1 ~ 26
if(num > 0 && num < 27)
// Replace 64 with 96 to get the
// lowercase alphabets
std::cout << char(num + 64) << "\n";
}
}
+ 2
You're welcome Legend Xtreme 79 : )
+ 1
Thanks!
+ 1
pretty good idea ipang
+ 1
thanks