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 Leute,

ich habe ein kleines Problem. Also ich habe ein Passwort program geschrieben und wollte ,dass bei der passwort eingabe nur sterne ausgegeben werden.

Hier mein script:

:mod:

#include <iostream>

#include<windows.h>

//für die farben

#define blau 9

#define turkise 11

#define gruen 10

#define rot 4

#define gelb 14

#define grau 8

#define white 15

#define black 0

void textcolor(WORD color) //Funktion fuer Farbe

{

SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE), color);

}

bool Fullscreen()

{

static bool bFullscreen = false;

keybd_event(VK_MENU,0x38,0,0);

keybd_event(VK_RETURN,0x1c,0,0);

keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);

keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);

return bFullscreen = !bFullscreen;

}

int f,t,r,m,n,o;

char pass3[]="yannicST";

char pass4[10];

char str2[10];

char str1[]="a4mt" ;

char pass2[10];

char pass1[]="gut" ;

int main()

{

textcolor(15);

printf("Enter username:\n");

gets (pass4);

n=strcmp (pass3, pass4);

if(n==0)

{

Sleep(800);

}

else

{

textcolor(4);

printf("!! Username is incorect !!");

for(int o = 0; o < 100000000 ; o++)

{

printf("\a");

Sleep(500);

}

printf("!! EXIT !!");

Sleep(900);

return 0;

}

textcolor(15);

printf("Enter password:\n");

textcolor(0);

gets (str2);

r=strcmp(str1, str2);

textcolor(15);

if(r==0)

{

Sleep(1000);

}

else

{

textcolor(4);

printf("!! Passwot is incorect !!");

for(int f = 0; f < 100000000 ; f++)

{

printf("\a");

Sleep(500);

}

textcolor(4);

printf(" EXIT NOW!!!");

Sleep(900);

return 0;

}

textcolor(10);

printf("Willkommen");

textcolor(15);

printf("\a");

printf(" wie geht es ihnen?");

gets (pass2);

t=strcmp (pass1, pass2);

if(t==0)

{

textcolor(10);

printf("Das ist toll!");

textcolor(15);

}

else

{

printf("Das ist sehr schade");

}

getchar();

}

danke schonmal

yannic ST

#include <iostream>

#include<windows.h>

//für  die farben

#define blau    9

#define turkise 11

#define gruen   10

#define rot     4

#define gelb    14

#define grau    8

#define white   15

#define black   0

void textcolor(WORD color)           //Funktion fuer Farbe 

{ 

    SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE), color); 

} 

bool Fullscreen()

    {

     static bool bFullscreen = false;

      keybd_event(VK_MENU,0x38,0,0);

      keybd_event(VK_RETURN,0x1c,0,0);

      keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);

      keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);

     return bFullscreen = !bFullscreen;

    }

    int f,t,r,m,n,o;

    char pass3[]="yannicST";           

    char pass4[10];

    char str2[10];

    char str1[]="a4mt" ;           

    char pass2[10];

    char pass1[]="gut" ;


      int main()

      {

      textcolor(15); 

      printf("Enter username:\n");

      gets (pass4);

      n=strcmp (pass3, pass4);

      if(n==0)

          {

          Sleep(800);

          }

      else

          {

          textcolor(4);

          printf("!! Username is incorect !!");

          for(int o = 0; o < 100000000 ; o++)

              {

               printf("\a");

               Sleep(500);

               }

          printf("!! EXIT !!");

          Sleep(900);

          return 0;

          }

      textcolor(15);

      printf("Enter password:\n");

      textcolor(0);

      gets (str2);

      r=strcmp(str1, str2);

      textcolor(15);

      if(r==0)

      {

      Sleep(1000);

      }

      else

      {

         textcolor(4);

         printf("!! Passwot is incorect !!");

         for(int f = 0; f < 100000000 ; f++)

            {

            printf("\a");

            Sleep(500);

            }

         textcolor(4);

         printf("    EXIT NOW!!!");

         Sleep(900);

         return 0;

      }

      textcolor(10);

      printf("Willkommen");

      textcolor(15);

      printf("\a");

      printf(" wie geht es ihnen?");

      gets (pass2);

      t=strcmp (pass1, pass2);

      if(t==0)

          {

          textcolor(10);

          printf("Das ist toll!");

          textcolor(15);

          }


      else

          {

           printf("Das ist  sehr schade");

          }

          getchar();

          }

Also ich sehe hier nichts, was dafür sorgen sollte, dass Sternchen statt den getippten Zeichen auf dem Bildschirm ausgeben werden.

Du liest mit der gets() Funktion ein, die gibt afaik genau das auch aus, was du tippst. Willst du das nicht, und das willst du ja nicht, dann kannst du gets() nicht verwenden. Du brauchst dazu z.B. eine Funktion, die von der Tastatur liest und kein Echo gibt. Dann kannst du manuell für jeden Tastendruck ein Sternchen auf der Konsole ausgeben.

Noch andere Anmerkungen:

- Wofür die ganzen Sleep() Aufrufe?

- Warum hast du (fast) alle Variablen global?

- Einrücken musst du noch üben

- Das was du da schreibst, nennt man unter Entwicklern Spaghetticode

- gets() zum Einlesen von Strings in char-arrays macht afaik keine Längenprüfung. Wenn du damit in char[10] einliest und jemand tippt 11 Zeichen, gibts einen buffer overflow.

- wenn du oben schon Defines für die Textfarben anlegst, wieso verwendest du dann im Code trotzdem die Zahlen und nicht die Namen?

Edit: Achja und verschlüsselt, wie du im Betreff schreibst, wird hier auch nichts.

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.