Code
#include <iostream>
#include <cstdlib>
using namespace std;
void prompt();
int main()
{
prompt();
char ans = 'y';
while (ans == 'y' || ans == 'Y')
{
cout << "Try Again(y/n)> ";
cin >> ans;
if (ans == 'y' || ans == 'Y')
{
prompt();
}
else
{
exit(0);
}
}
return 0;
}
void prompt()
{
char sing_ch;
cout << "\n\n Print code (ASCII code / Unicode code etc.) of a given character:\n";
cout << "-----------------------------------------------------------------------\n";
cout << " Input a character: ";
cin >> sing_ch;
cout << " The ASCII value of " << sing_ch << " is: " << (int)sing_ch << endl;
cout << " The character for the ASCII value " << (int)sing_ch << " is: " << (char)((int)sing_ch) << endl << endl;
}
