PDA

View Full Version : ASCII code of c++



Vuhelper
06-07-2011, 07:01 PM
ASCII code of null character is always zero .WE represent the ASCII Code by "/0".
All string are terminated with null character. its Means ASCII code are use to terminate a string


#include <iostream>
using namespace std;


int main(){
char ascii;
int numeric;
cout << "Give character: ";
cin >> ascii;
cout << "Its ascii value is: " << (int) ascii << endl;
cout << "Give a number to convert to ascii: ";
cin >> numeric;
cout << "The ascii value of " << numeric << " is " << (char) numeric;
return 0;
}