Skip to content

Instantly share code, notes, and snippets.

@uplus
Created July 14, 2016 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uplus/c0075a23d64dae7598962cb431d02913 to your computer and use it in GitHub Desktop.
Save uplus/c0075a23d64dae7598962cb431d02913 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, const char* argv[]){
int n = argc == 1? 1: atoi(argv[1]);
if(n%15 == 0) cout << "FizzBuzz" << endl;
else if(n%3 == 0) cout << "Fizz" << endl;
else if(n%5 == 0) cout << "Buzz" << endl;
else cout << n << endl;
string s = (string{ argv[0] } + " " + to_string(n+1));
if(n != 100) system(s.c_str());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment