Nie wiem dlaczego moja pętla jest nieskonczona nawet jesli wprowadze char kończący warunek. Pomoże ktoś pls?
#include <iostream>
#include <fstream>
#include <windows.h>
#include <conio.h>
using namespace std;
char wybor;
string dane;
int main()
{
do
{
cout << "Wprowadz dane: ";
getline(cin, dane);
cout << "IF YOU WANT SAVE TO FILE PRESS ( y ) to save to file, or ( n ) to exit to menu.";
wybor=getch();
switch (wybor)
{
case 'y':
{
ofstream plik;
plik.open("Dane.txt",ios::out|ios::app);
plik << dane <<endl<<endl;
cout << "Zapisano dane"<<endl;
plik.close();
system("PAUSE");
}
break;
}
}
while (wybor!='y'||'n');
return 0;
}