C++ examples for Function:Function Creation
Prints the ASCII character of the user's number. Prototype function.
#include <iostream> using namespace std; char ascii(int num); void main()/*from w w w .ja v a2 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); }