I am new to C++ and programming in general and was trying to figure out a way to create a switch in C++ to trigger when a number entered is divisible by 3, by 5, and by both 3 and 5. Here is what I have so far:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int number;
cout << "Please input a number and then press the enter key" << endl;
cin >> number;
switch (number){
case "/3":
cout << "Fizz" << endl;
break;
case "/5":
cout << "Buzz" << endl;
break;
case "/3" "/5":
cout << "FizzBuzz" << endl;
break;
default:
cout << "Please select another number." << endl;
}
}
Any help with this would be greatly appreciated! :)