Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double num;
- char again;
- do
- {
- cout << "Enter an integer: ";
- cin >> num;
- //cout << endl;?
- //(IT LOOKS LIKE IT DOESN'T NEED AN endl HERE)
- while (num != static_cast<int>(num))
- {
- cout << "ERROR. Enter an integer: ";
- cin >> num;
- }
- if (static_cast<int>(num) % 3 == 0)
- {
- if (static_cast<int>(num) % 5 == 0)
- {
- cout << "FizzBuzz\n";
- }
- else
- {
- cout << "Fizz\n";
- }
- }
- else if (static_cast<int>(num) % 5 == 0)
- {
- cout << "Buzz\n";
- }
- else
- {
- cout << "Blah\n";
- }
- //Does the user want to input another number?
- cout << "Do you want to enter another number? (Y/N) ";
- cin >> again;
- } while (again == 'Y' || again == 'y');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement