Created
July 2, 2021 09:26
-
-
Save badboy/21484fbf43808fffe16fe3d7f7358ad0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build: c++ -std=c++14 fizzbuzz.js.cpp | |
#include <iostream> | |
#define function auto | |
#define var auto | |
class Console { | |
public: | |
void log(std::string msg) { | |
std::cout << msg << std::endl; | |
} | |
void log(int msg) { | |
std::cout << msg << std::endl; | |
} | |
}; | |
auto console = Console(); | |
function fizzbuzz() { | |
var i = 1; | |
while (i <= 100) { | |
if (i % 15 == 0) { | |
console.log("FizzBuzz"); | |
} else if (i % 3 == 0) { | |
console.log("Fizz"); | |
} else if (i % 5 == 0) { | |
console.log("Buzz"); | |
} else { | |
console.log(i); | |
} | |
i++; | |
} | |
} | |
int main() | |
{ | |
fizzbuzz(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment