Created
October 10, 2013 21:49
-
-
Save imryan/6926175 to your computer and use it in GitHub Desktop.
Finding argument count in main method, and playing with a struct.
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
| #include <iostream> | |
| using namespace std; | |
| int main(int argc, char *argv[]) | |
| { | |
| cout << "there are " << argc << " arguments:" << endl; | |
| for (int narg = 0; narg < argc; narg++) { | |
| cout << narg << " " << argv[narg] << endl; | |
| } | |
| struct cat { | |
| bool hasFur; | |
| bool hasTail; | |
| string name; | |
| } mine; | |
| mine.hasFur = true; | |
| mine.hasTail = true; | |
| mine.name = "mr.kitty"; | |
| cout << mine.name << endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment