Witam, stworzyłem prosty panel logowania, w którym po pomyślnym zalogowaniu można dodać profil studenta (imię, nazwisko oraz pesel). Nie wiem jednak w jaki sposób odczytać wprowadzone dane... Pomożecie?
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <fstream>
using namespace std;
string login, haslo;
string imie, nazwisko,pesel;
char wybor;
int main()
{
do
{
cout<<"-----------------------------ZALOGUJ SIE DO SYSTEMU-----------------------------"<<endl;
cout << "Podaj login: ";
cin>>login;
cout << "Podaj haslo: ";
cin>>haslo;
if(login!="admin" || haslo!="janek")
{
cout<<"Niepoprawny login lub haslo!"<<endl;
}
getchar();getchar();
system("cls");
}while(login!="admin" || haslo!="janek");
system("cls");
for(;;)
{
cout<<"----------------------------PANEL ADMINISTRATORA--------------------------------"<<endl;
cout<<endl<<"1. Dodaj profil studenta"<<endl;
cout<<"2. Lista studentow"<<endl;
cout<<"3. Wyjscie"<<endl;
wybor = getch();
switch(wybor)
{
case '1':
{
system("cls");
cout<<"Imie: "; cin>>imie;
cout<<"Nazwisko: "; cin>>nazwisko;
cout<<"PESEL: "; cin>>pesel;
fstream plik;
plik.open("profile.txt", ios::out | ios::app);
plik<<imie<<endl;
plik<<nazwisko<<endl;
plik<<pesel<<endl;
plik.close();
getchar();
cout<<endl<<"Pomyslnie dodano profil!"<<endl;
}
break;
case '2':
{
//wczytywanie danych (profili studentow) z pliku//
getchar();
system("cls");
}
break;
case '3':
{
exit(0);
}
break;
default: cout<<"Nie ma takiej opcji w menu!"<<endl;
getchar();
system("cls");
break;
}
}
return 0;
}