Odczytanie zmiennej do pliku CPP
int main()
{
// writing process
char name[20], phone[20];
cout<< "Enter your name: ";
cin>> name;
cout<< "Enter you phone number: ";
cin>> phone;
ofstream file_w ("test.txt");
file_w << name <<endl
<< phone<<endl;
cout << "Process complete";
file_w.close();
// reading the vairable's values
ifstream file_r ("test.txt");
char Name[20], Phone[20];
file_r >> Name >> Phone;
cout<< "Name = " << Name << endl << "Phone = " << Phone ;
return 0;
}
Sleep deprived