hey this is a just for fun topic (a.k.a. NOT homework) but if you can please reply:
I am working in Visual C++ and I can't get any <iostream> operation to write a single character to a variable and then check it in an if() statement. Here is my last try:
#include <iostream>
using namespace std;
int main()
{
char k;
cin>>k;
if(k='r')
cout<<k;
else if(k='f')
cout<<k<<"!";
else{}
cin>>k;
return 0;
}
Even when I input a 'f', it prints 'r'. It's almost like it's skipping the if().