Advertisement
X-88

StrtoHex.cpp

Dec 27th, 2021
1,071
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. /*
  5. Writed by: Zephio
  6. Convert String to Ordinal & Hexadecimal
  7. */
  8. string s;
  9. int i;
  10. int main(int argc, char *argv[])
  11. {
  12.     cout << "Masukkan Text: ";
  13.     getline(cin, s);
  14. for (i = 0; i < s.length(); i++)
  15. {
  16.     cout << "Char" << i + 1 <<": " << s[i] << ", Dec: " << int(s[i]) << ", Hex: " << hex << int(s[i]) << endl;
  17. }
  18. }
Advertisement
RAW Paste Data Copied
Advertisement