Peeps. I'm a noob. I have a question to ask but here's my code below.
int main() {
int a, c, favNum;
favNum = 3;
cout << "Hello! Please enter a number in the space below. This number will be called 'a'. " << endl;
cout << "Enter: " << endl;
cin >> a;
if ( typeid(a) == typeid(int) && cin.fail()==false){
cout << "Great Job!" << endl;
cout << "Let's do cool stuff with this program! " << endl;
* cout << "Type '1' for checking whether your number, " + a + ", is a
number divisible by," + favNum + "." << endl;
cout << "Type '2' to recieve a compliment " << endl;
cin >> c;
switch (c) {
case 1:
cout << "Awesome!" << endl;
if( a%favNum == 0 ){
* cout << "Your 'a' number, " +a+ ", is a number divisible by
'favNum'," +favNum+ "." << endl;
} else if (a%favNum != 0){
* cout << "Your 'a' number, " +a+ ", is a number not divisible by
'favNum'," +favNum+ "." << endl;
}
break();
case 2:
cout << "Great Job!" << endl;
}
} else {
cout << "Oops.. Might wanna try to write a number. Doesn't look like a
number to me.." << endl;
cout << "Please restart your program and follow instructions next
time."
<< endl;
}
Basically what my program does is it takes an input of a number 'a', and checks if it's a number and if it is, it uses "switch case" to direct me to 2 options.
Problem: It shows me this weird error "error: invalid operands of types 'const char' and 'const char [28]' to binary 'operator+'" and I have no idea what it means. It popped me this error on lines 16,23,and 25, and I asterisked the lines so you can see where the error shows up. Thanks if you can help me!
EDIT: My question WAS what is the error? and why my program is not working? I realized that I had done a + b instead of a << "+" << b. I've been working on 2-3 languages in coding, and I made an error. Just 1 day ago, I even said my question was answered. Thank you.
BTW: Program worked just fine before switch case! LOL EDIT: Question solved.