i have this program when i press 6 the program should exit why is this not working. when i press 6 i get garbage value is my logic right
Code:#include <iostream>
using namespace std;
template <typename mytype>
mytype fun (mytype a, mytype b, mytype c)
{
if(b>c)
{
return(b);
}
}
int main ()
{
int a,b,c,select;
cout << "Types of gates available:"<<'\n';
cout << "1. And"<<'\n';
cout << "2. Or"<<'\n';
cout << "3. And"<<'\n';
cout << "4. Or"<<'\n';
cout << "5. And"<<'\n';
cout << "6. exit"<<'\n';
cout << "Select gate #1"<<'\n';
cin>>a;
while(!a==6)
{
cout<<"Enter two inputs for gates =>"<<'\n';
cin>>b;
cin>>c;
}
cout<<fun(a,b,c);
cin.sync();
cin.get();
return 0;
}