I must write short script which will change int to ASCII char and char to ASCII int. But i don't know how. I wrote this short code but something is wrong. I'm programming for half-year. Can someone write it working? It is my first time to use functions in c++
#include <iostream>
#include <conio.h>
using namespace std;
char toChar(int n) {
return n + '0';
}
int toInt(char c) {
return c - '0';
}
int main()
{
int number;
cout << "Int: ";
cin >> number;
cout << "ASCII: " << static_cast<char>(number);
getch();
return 0;
}