logowanie w konsoli baza danych użytkowników z pliku
Ostatnio zmodyfikowano 2014-01-02 19:07
chelios Temat założony przez niniejszego użytkownika |
logowanie w konsoli baza danych użytkowników z pliku » 2014-01-02 15:51:41 Witam, piszę tu do was z nie trywialnym problemem. Chciałbym prosić o pomoc w napisaniu/dokończeniu tego małego programu, chodzi o to żeby użytkownik podał login hasło a to co on poda zostało sprawdzone czy takie dane znajdują się w pliku użytkownicy.cpp/bin/txt ?? nie wiem w jakim było by naj lepiej tu macie kod programu który dotąd zrobiłem : #include<iostream> #include<conio.h> #include <windows.h> using namespace std;
struct uzytkownik { char nazwa; char haslo; };
void powitanie(); float logowanie(); float zaloguj(); void dodaj(); void edytuj(); void usun(); float menu_glowne();
HANDLE g_hConsol = GetStdHandle( STD_OUTPUT_HANDLE ); void gotoxy( const int x, const int y ) { COORD coord = { x, y }; SetConsoleCursorPosition( g_hConsol, coord ); }
int main() { int koniec = 1, wybor; while( koniec ) { system( "cls" ); powitanie(); cin >> wybor; if( wybor == 2 ) koniec = 0; else { switch( wybor ) { case 1: { system( "cls" ); logowanie(); break; } default: { cout << "bledny wybor" << endl; break; } } getch(); } } return 0; }
void powitanie() { cout << "******************************" << endl; cout << "* BAZAAA DANYCH tralalal *" << endl; cout << "******************************" << endl; cout << " 1) LOGOWANIE " << endl; cout << " 2) WYJSCIE Z PROGRAMU " << endl; cout << "******************************" << endl; }
float logowanie() { int koniec = 1, wybor = 0; while( koniec ) { system( "cls" ); cout << "**************************************" << endl; cout << "* LOGOWANIE *" << endl; cout << "**************************************" << endl; cout << "* 1)ZALOGUJ SIE| *" << endl; cout << "**************************************" << endl; cout << "* 2)NOWY UŻYT | 3) EDYTUJ |4) USUŃ *" << endl; cout << "**************************************" << endl; cout << " 5)Wstecz " << endl; cout << "**************************************" << endl; cin >> wybor; if( wybor == 5 ) koniec = 0; else { switch( wybor ) { case 1: { system( "cls" ); zaloguj(); break; } case 2: { system( "cls" ); dodaj(); break; } case 3: { system( "cls" ); edytuj(); break; } case 4: { system( "cls" ); usun(); break; } default: { cout << "bledny wybor" << endl; break; } } } } }
float zaloguj() { cout << "******************************" << endl; cout << "* LOGOWANIE *" << endl; cout << "******************************" << endl; cout << "* Login :................ *" << endl; cout << "* Haslo :................ *" << endl; cout << "******************************" << endl; cout << "* [ENTER] ZALOGUJ *" << endl; cout << "******************************" << endl; getch(); return 0; } void dodaj() { cout << "******************************" << endl; cout << "* LOGOWANIE *" << endl; cout << "******************************" << endl; cout << "* Login :................ *" << endl; cout << "* Haslo :................ *" << endl; cout << "******************************" << endl; cout << "* [ENTER] DODAJ *" << endl; cout << "******************************" << endl; getch(); }
void edytuj() { cout << "******************************" << endl; cout << "* EDYTOWANIE UZYTKOWNIKA *" << endl; cout << "******************************" << endl; cout << "* Login :................ *" << endl; cout << "******************************" << endl; cout << "* [ENTER] SZUKAJ *" << endl; cout << "******************************" << endl; getch(); system( "cls" ); cout << "******************************" << endl; cout << "* EDYTOWANIE UZYTKOWNIKA *" << endl; cout << " ' STASIOOO1234 ' " << endl; cout << "******************************" << endl; cout << "* co chcesz zmienic? *" << endl; cout << "******************************" << endl; cout << "* 1) LOGIN 2) HASLO *" << endl; cout << "******************************" << endl; getch(); system( "cls" ); cout << "******************************" << endl; cout << "* EDYTOWANIE UZYTKOWNIKA *" << endl; cout << " ' STASIOOO1234 ' " << endl; cout << "******************************" << endl; cout << "* Wprowadz nowy ...... " << endl; cout << "******************************" << endl; cout << "* ................... *" << endl; cout << "******************************" << endl; getch(); system( "cls" ); cout << "******************************" << endl; cout << "* EDYTOWANIE UZYTKOWNIKA *" << endl; cout << " ' ZAKONCZONE ' " << endl; cout << "******************************" << endl; getch(); }
void usun() { cout << "******************************" << endl; cout << "* USUWANIE UZYTKOWNIKA *" << endl; cout << "******************************" << endl; cout << "* Login :................ *" << endl; cout << "******************************" << endl; cout << "* [ENTER] ZATWIERDZ *" << endl; cout << "******************************" << endl; getch(); } float menu_glowne() { system( "cls" ); cout << "******************************" << endl; cout << " Program baza danych" << endl; cout << "******************************" << endl; cout << " 1) jakas tam funkcja " << endl; cout << " 2) jakas tam funkcja " << endl; cout << "******************************" << endl; cout << " 3) WYLOGUJ " << endl; cout << "******************************" << endl; int koniec = 1, wybor = 0; while( koniec ) { cin >> wybor; if( wybor == 3 ) koniec = 0; else { switch( wybor ) { case 1: { cout << "jakas funkcja 1" << endl; break; } case 2: { cout << "jakas funkcja 2" << endl; break; } default: { cout << "bledny wybor" << endl; break; } } getch(); } } return 0; } |
|
pekfos |
» 2014-01-02 18:51:56 |
|
chelios Temat założony przez niniejszego użytkownika |
» 2014-01-02 19:07:02 mhy, no ale jak miała by wyglądać funkcja, mózg który by to ogarniał |
|
« 1 » |