It has been months since I did anything on c++, I took a certificate course. I only learned the basics, and wanted to refresh myself. I am trying to make a simple RNG calculator. I am writing code to confirm the max and min entered by the user. However, the confirmation code is not doing the if else correct. No matter what char confirm is, it defaults to the first statement in the "if (confirm == 'Y' || 'y')" (It has been a while, please don't critisize my code too too much)
#include <iostream>
#include <string>
using namespace std;
int max ()
{
int max;
int restart = 1;
char confirm;
do
{
cout << "What is the maxium number you want to be able to generate?";
cin >> max;
cout << "Let me confirm. Your maximum number is " << max << ", is this correct? (Y/N)";
cin >> confirm;
if (confirm == 'Y' || 'y') {
cout << "y";
return max;
}
else
{
}
}while (restart == 1);
}
int main ()
{
int maximum = max();
cout << maximum;
return 0;
}