Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:c2d61f919dad, committed 2020-04-21
- Comitter:
- jesephin
- Date:
- Tue Apr 21 20:09:42 2020 +0000
- Commit message:
- ZeichenAlsDec_HexAusgeben.cpp
Changed in this revision
| ZeichenALsDec_HexAusgeben.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r c2d61f919dad ZeichenALsDec_HexAusgeben.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ZeichenALsDec_HexAusgeben.cpp Tue Apr 21 20:09:42 2020 +0000
@@ -0,0 +1,21 @@
+/*Schreiben Sie ein Konsolenprogramm, das ein Zeichen einliest und dieses Zeichen sowohl
+als Zeichen als auch als Dezimal- bzw. Hexadezimalwert ausgibt.
+Verwenden Sie sowohl scanf als auch cin für die Eingabe, bei der Ausgabe probieren Sie
+cout und printf aus.*/
+
+
+#include <iostream>
+using namespace std;
+int main()
+{
+ char zeichen;
+
+ cout << "Geben Sie ein Zeichen ein: ";
+ cin >> zeichen;
+ cout << zeichen<< endl;
+ cout << " Als decimal value ist : " << int(zeichen) << endl
+ << " Als hex value ist : " << "0x";
+ printf( "%x\n",zeichen );
+
+ return 0;
+}
\ No newline at end of file