Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe dieses Programm probiert. Klappt leider nicht:

#include <iostream>

#define LINKS 75
#define RECHTS 77
#define HOCH 72
#define RUNTER 80

int main()

{

char steuerung;

 

std::cout << "Geben Sie Cursor links, rechts, oben oder unten ein: ";

std::cin >> steuerung;

 

std::cout << "Die Steuerung war: " << steuerung << std::endl;

 

return 0;

}

Wenn ich z. B.Cursor links drücke, erhalte ich ^[[D
und nach drücken der Entertaste erhalte ich eine leere Ausgabe für steuerung.

LG Heiko

Das Abfragen von keystrokes ist OS spezifisch, die C++ standard library hat aber keine OS spezifisichen Implementationen, vor allem nicht für den input stream. Du benötigst als eine plattformabhängige library um die arrow keys zu catchen. Für Linux ist das simpelste wohl der conio header, ncurses wäre eine fully-fledged library für alles was mit (physical) user input zu tun hat.  Keine Ahnung was es für Windows gibt

  • Autor

Moin.

Danke für die Antworten. Das Ganze ist mir noch zu kompliziert. Ich lerne C++ erst wieder neu.

 

Aber davon abgesehen, ich habe doch wie gewünscht eine eigene Frage gestellt. Und das war nur eine Frage.

 

LG Heiko

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.