Ändern von deklarationen
-
Hallo hab da ne frage:
Ich lerne seit 2 Monaten die Programmiersprache C
nun war mir mal etwas fad und ich schrieb ein kleines "Spaßprogramm":#include <stdio.h> #include <stdlib.h> #include <conio.h> int main(void) { while ( 1 ) { double code, a, as, as1; char p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, enter, r, so; printf("Schulordner? (y/n)\n"); as=getch(); if (as == 'y') { system("explorer C:\\Schule"); printf("Moechten sie fortfahren? (y/n)\n"); as1=getch(); if (as1 == 'n') { return 0; } } printf("Code(Zahl): "); scanf("%lf", &code); if (code != 45.65) { printf("Falscher Parameter!!!\n\n"); fflush(stdin); } if (code == 45.65) { printf("password: "); p1=getch(); p2=getch(); p3=getch(); p4=getch(); p5=getch(); p6=getch(); p7=getch(); p8=getch(); p9=getch(); p10=getch(); p11=getch(); p12=getch(); enter=getch(); printf("\n"); if (p1 != '1') { printf("password incorrect!!!\n\n"); } if (p2 != '2') { printf("password incorrect!!!\n\n"); } else if (p3 != '3') { printf("password incorrect!!!\n\n"); } else if (p4 != '4') { printf("password incorrect!!!\n\n"); } else if (p5 != '5') { printf("password incorrect!!!\n\n"); } else if (p6 != '6') { printf("password incorrect!!!\n\n"); } else if (p7 != '7') { printf("password incorrect!!!\n\n"); } else if (p8 != '8') { printf("password incorrect!!!\n\n"); } else if (p9 != '9') { printf("password incorrect!!!\n\n"); } else if (p10 != '0') { printf("password incorrect!!!\n\n"); } else if (p11 != '1') { printf("password incorrect!!!\n\n"); } else if (p12 != '2') { printf("password incorrect!!!\n\n"); } if (p1 == '1') { if (p2 == '2') { if (p3 == '3') { if (p4 == '4') { if (p5 == '5') { if (p6 == '6') { if (p7 == '7') { if (p8 == '8') { if (p9 == '9') { if (p10 == '0') { if (p11 == '1') { if (p12 == '2') { printf("\npassword correct\n"); { while ( 1 ) { printf("\n\n1: Hauptordner\n2: Bilder\n3: Filme\n4: Schule\n5 zum beenden\n6 um ihr Passwort zu aendern\n"); printf("\nWas wollen sie tun?\n"); a=getch(); if (a == '1') { printf("\n\nis now loading...\n"); system("explorer C:\\Windows\\System32\\drivers\\etc\\VersteckteDaten"); printf("\nfinish\n\n"); break; } if (a == '2') { printf("\n\nis now loading...\n"); system("explorer C:\\Windows\\System32\\drivers\\etc\\VersteckteDaten\\Bilder"); printf("\nfinish\n\n"); break; } if (a == '3') { printf("\n\nis now loading...\n"); system("explorer C:\\Windows\\System32\\drivers\\etc\\VersteckteDaten\\Filme"); printf("\nfinish\n\n"); break; } if (a == '4') { printf("\n\n1: Deutsch\n2: Programmieren\n3: Englisch\n4: NW2\n5: Referate\n"); so=getch(); if (so == '1') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Deutsch"); printf("\nfinish\n\n"); break; } if (so == '2') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Programmieren"); printf("\nfinish\n\n"); break; } if (so == '3') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Englisch"); printf("\nfinish\n\n"); break; } if (so == '4') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\NW2"); printf("\nfinish\n\n"); break; } if (so == '5') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Referate"); printf("\nfinish\n\n"); break; } } if (a == '5') { break; } if (a == '6') { printf("Geben sie nun ihr neues Passwort ein (ACHTUNG...Falscheingabe unkorrigierbar!):"); p1=getch(); p2=getch(); p3=getch(); p4=getch(); p5=getch(); p6=getch(); p7=getch(); p8=getch(); p9=getch(); p10=getch(); p11=getch(); p12=getch(); break; } } } //Abfrage zum beenden printf("\nMoechten sie fortfahren? (y/n): "); r=getch(); printf("\n\n"); if (r == 'n') { return 0; //Endsequence } } } } } } } } } } } } } fflush(stdin); } } }
nun möchte ich mit der Funktion 6 das "Passwort" ändern nur wie kann ich dass machen das es das speichert?
Bitte um rasche Hilfe
Mfg AllesNeu
-
ich denke AllesNeu ist da die einzig richtige antwort
-
Wieso ... hast du die selbe Frage?
Mfg
-
AllesNeu schrieb:
Wieso ... hast du die selbe Frage?
Mfgnö, ich kenne nur die antwort
-
Und ... könntest du mir bitte weiterhelfen?
Mfg
-
Bitte
-
wenn du das passwort fest in dein programm reincodierst kannst es nicht/(os abhängig schwer) ändern. also nimm sowas natürlich total buggy aber was solls...
char password[50] = "startpass"; char eingabe[50] = ""; while(1){ printf("pass:\n"); scanf("%49s",eingabe); if(strcmp(password,eingabe)==0) puts("pass ok"); else puts("pass nok"); printf("new pass:\n"); scanf("%49s",password); }
-
Kann man mit dieser funktion das Passwort bei der eingabe auch unsichtbar machen ... alse das es nicht aufscheint?
Danke erstmals für die Lösung
-
Hello World schrieb:
Kann man mit dieser funktion das Passwort bei der eingabe auch unsichtbar machen ... alse das es nicht aufscheint?
nein
-
Das Passwort lässt sich damit auch nicht ändern.
ich gebe das neue PW ein aber es funkt nur wieder mit dem alten.
-
Hello World schrieb:
Das Passwort lässt sich damit auch nicht ändern.
ich gebe das neue PW ein aber es funkt nur wieder mit dem alten.ach, echt
-
was soll ich nur tun? hilf mir bitte!
-
hab einen warning:
imlict decleration of function 'strcmp'
benötige ich dafür ein Include?
-
Hello World schrieb:
hab einen warning:
imlict decleration of function 'strcmp'
benötige ich dafür ein Include?Ja.
<string.h>
-
jap 0 errors 0 warnings
aber was mus ich jetzt schreiben um das passwort zu ändern? Source code sieht nun so aus :#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> int main(void) { while ( 1 ) { double code, a, as, as1; char r, so; char password[50] = "startpass"; char eingabe[50] = ""; printf("Schulordner? (y/n)\n"); as=getch(); if (as == 'y') { system("explorer C:\\Schule"); printf("Moechten sie fortfahren? (y/n)\n"); as1=getch(); if (as1 == 'n') { return 0; } } printf("Code(Zahl): "); scanf("%lf", &code); if (code != 45.65) { printf("Falscher Parameter!!!\n\n"); fflush(stdin); } if (code == 45.65) { printf("password: "); scanf("%49s",eingabe); printf("\n"); if (strcmp(password,eingabe)==0) { printf("\npassword correct\n"); { while ( 1 ) { printf("\n\n1: Hauptordner\n2: Bilder\n3: Filme\n4: Schule\n5 zum beenden\n6 um ihr Passwort zu aendern\n"); printf("\nWas wollen sie tun?\n"); a=getch(); if (a == '1') { printf("\n\nis now loading...\n"); system("explorer C:\\Windows\\System32\\drivers\\etc\\VersteckteDaten"); printf("\nfinish\n\n"); break; } if (a == '2') { printf("\n\nis now loading...\n"); system("explorer C:\\Windows\\System32\\drivers\\etc\\VersteckteDaten\\Bilder"); printf("\nfinish\n\n"); break; } if (a == '3') { printf("\n\nis now loading...\n"); system("explorer C:\\Windows\\System32\\drivers\\etc\\VersteckteDaten\\Filme"); printf("\nfinish\n\n"); break; } if (a == '4') { printf("\n\n1: Deutsch\n2: Programmieren\n3: Englisch\n4: NW2\n5: Referate\n"); so=getch(); if (so == '1') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Deutsch"); printf("\nfinish\n\n"); break; } if (so == '2') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Programmieren"); printf("\nfinish\n\n"); break; } if (so == '3') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Englisch"); printf("\nfinish\n\n"); break; } if (so == '4') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\NW2"); printf("\nfinish\n\n"); break; } if (so == '5') { printf("\n\nis now loading...\n"); system("explorer C:\\Schule\\Referate"); printf("\nfinish\n\n"); break; } } if (a == '5') { break; } if (a == '6') { printf("Geben sie nun ihr neues Passwort ein: "); scanf("%49s",password); break; } } } //Abfrage zum beenden printf("\nMoechten sie fortfahren? (y/n): "); r=getch(); printf("\n\n"); if (r == 'n') { return 0; //Endsequence } } else puts("password incorrect\n"); fflush(stdin); } } }
-
exit(1);
-
Wo soll ich das hinschreiben?
-
BITTE .... Kann mir denn niemand helfen ????
-
Hallo?
-
ich bin mir sicher dass ich geändert werde.
jedes mal wenn du mich eingibst.
gib mich doch mal vor dem return 0; aus.