Bueno este es un simple codigo que saque por una duda que tenia referente a los ASCII
//*********************************************
// Ingresa una serie de caracteres y devulve
// su codificaci¢n en ASCII
//*********************************************
#include
#include
using namespace std;
void getAscii(char *);
int main(){
char phrase[200];
system("cls");
cout<> ";
cin.getline(phrase,200);
getAscii(phrase); //Function for get the code ASCII
system("pause>nul");
return 0;
}
//*********************************************
// Funcion : getAscii()
// Recibe como parametro un arreglo de chars
// y convierte los caracteres a ASCII
//*********************************************
void getAscii(char *msg){
int i;
cout<<"\n\tCONVERSION CHARS TO ASCII \n";
cout<<"\t------------------------------------\n";
cout<<"\n\t [ORIGINAL]\n\t ";
i = 0;
while(true){
cout<<msg[i];
i++;
if(msg[i] == '') break;
if(i%15 == 0) cout<<"\n\t ";
cout<<"-";
}
cout<<"\n\n\t [ASCII]\n\t ";
i = 0;
while(true){
cout<<(int)msg[i];
i++;
if(msg[i] == '') break;
if(i%15 == 0) cout<<"\n\t ";
cout<<"-";
}
cout<<"\n\n\t------------------------------------";
cout<<"\n\t # Chars : "<<i;
//# The END
#
}
Greetings to all and happy Bandwidth