C++ Function Parameter Prints the ASCII character of the user's number

Description

C++ Function Parameter Prints the ASCII character of the user's number

#include <iostream>
using namespace std;
char ascii(int num);
void main()//  w ww  . j a  va  2 s  .  c  om
{
   int num;
   char asc_char;
   cout << "Enter an ASCII number? ";
   cin >> num;
   asc_char = ascii(num);
   cout << "The ASCII character for " << num << " is " << asc_char;
   return;
}
char ascii(int num)
{
   char asc_char;
   asc_char = char(num);  
   return (asc_char);
}



PreviousNext

Related