#include #include /* ORIGINAL A short ascii conversion program. ** intc() function needs to be fixed. Writen by Andre Jones under the GNU Public License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ using namespace std; void charc() { char y; cout << "Enter character: " << endl; cin >> y; cout << "The ascii chart number for "; cout << y << " will be: " << int ( y ) << endl; } void intc() { int f; cout << "Enter number: " << endl; cin >> f; cout << "The ascii chart number for " << f << " will be: " << endl; cout << static_cast(f) << endl; } void conv1() { int x; cout << "Enter ascii chart number: " << endl; cin >> x; cout << "Your value will be: " << char ( x ) << endl; } void conv2() { char ans[4]; cout << "Do you have a number?" << endl; cin >> ans; if ( strcmp ( ans, "yes" ) == 0) { intc(); } else { cout << "You must have a character to convert then" << endl; charc(); } } int main() { int x; cout << "1: Convert number on ascii chart to it's output" << endl; cout << "2: Convert letter or number into ascii chart number " << endl; cout << "0: quit " << endl; int input; cin >> input; switch ( input ) { case 1: conv1(); break; case 2: conv2(); break; default: return 0; break; } cin.get(); }