Czy ktos moglby poinstruować jakąś radą? Interesuje mnie jakies skladnie ktore pomogly by mi zapisywac i odczytywac dane z pliku .txt
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
using namespace::std;
int main()
{
string *tekst,a,b;
int c,d,e,start,wybor;
tekst=&a,&b,&c,&d,&e;
cout << "PROGRAM - BAZA DANYCH STUDENTÓW - INFORMATYKA" << endl;
cout << endl;
cout << "Zapisywanie listy studentów 1" << endl;
cout << endl;
do
{
cout << "IMIĘ : " << endl;
cin >> a;
cout << "NAZWISKO : " << endl;
cin >> b;
cout << "WIEK : " << endl;
cin >> c;
cout << "NUMER ALBUMU : " << endl;
cin >> d;
cout << "ŚREDNIA OCEN : " << endl;
cin >> e;
ofstream plik_odczyt;
plik_odczyt.open("listabazak1.txt");
plik_odczyt << tekst;
plik_odczyt.close();
}
while (start<=20);
cout << endl;
cout << "Wczytywanie listy studentów" << endl;
cout << endl;
ifstream plik_odczyt("C:/listabazak1.txt");
if (plik_odczyt.is_open())
{
while (plik_odczyt.good())
{
getline(plik_odczyt,tekst);
cout << tekst << endl;
}
plik_odczyt.close();
}
cout << endl;
cout << "Operacje na danych" << endl;
cout << endl;
cout << endl;
cout << "Zapis listy studentów" << endl;
cout << endl;
cout << endl;
getch();
return 0;
}