Created
November 13, 2011 10:45
-
-
Save cypres/1361976 to your computer and use it in GitHub Desktop.
hoppity hop
This file contains 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
#include <iostream> | |
#include <stdio.h> | |
#include <stdlib.h> | |
using namespace std; | |
int main(int argc, char** argv) { | |
if (argc != 2) { | |
cout << "Wrong number of arguments: " << argc << endl; | |
return 1; | |
} | |
int l=atoi(argv[1]); | |
if (l == 0) { | |
cout << "Unknown integer: " << argv[1] << endl; | |
return 1; | |
} | |
for(int i=1; i<=l; i++) { | |
if (i%5==0 && i%3==0) cout << "Hop" << endl; | |
else if (i%5==0) cout << "Hophop" << endl; | |
else if (i%3==0) cout << "Hoppity" << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment