fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void wyswietlLancuch(const string &str)
  5. {
  6. cout << str << dec << "( " << str.length() << " )" << endl;
  7. for(string::const_iterator it = str.begin(), epos = str.end(); it != epos; ++it) {
  8. cout << hex << (static_cast<int>(*it) & 0xff);
  9. cout << ", ";
  10. }
  11. }
  12.  
  13. int main()
  14. {
  15. string tekst = "ĄĆŻŹąćżź";
  16. cout << "Tekst z kodu: ";
  17. wyswietlLancuch(tekst);
  18. cout << endl;
  19. cin >> tekst;
  20. if (!tekst.empty())
  21. {
  22. cout << "Tekst wprowadzony: ";
  23. wyswietlLancuch(tekst);
  24. cout << endl;
  25. }
  26. }
Success #stdin #stdout 0s 3032KB
stdin
ĄĆŻŹąćżźa
stdout
Tekst z kodu: ĄĆŻŹąćżź( 16 )
c4, 84, c4, 86, c5, bb, c5, b9, c4, 85, c4, 87, c5, bc, c5, ba, 
Tekst wprowadzony: ĄĆŻŹąćżźa( 17 )
c4, 84, c4, 86, c5, bb, c5, b9, c4, 85, c4, 87, c5, bc, c5, ba, 61,