Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // These are the headers you need to include for a simple C++ Program, IOSTREAM being the Standard C++
- // header while STDIO is the Standard Input and Output header.
- #include <iostream>
- #incude <stdio.h>
- // here we include the Standard Namespace
- using namespace std;
- // This is the Main Body, the Execution of the program!
- // Here we have argc and argv, argc being our Argument Counter, while argv being our Argument vector.
- // argc counts how many arguments we've passed while argv contains all the data that you pass from the
- // console, making it easier to apply switches to better function your program.
- int main( int argc, char *argv[] ) {
- // Prints Hello World! and then breaks to a new line
- cout << "Hello World!" << endl;
- // This is a for counter, for which our new variable i = 0, and we need to create a condition
- // where argc is the max we can count, and i++ increments by 1 until we meet argc
- for(int i = 0; i < argc; i++)
- // We print the Argument here
- // E.G. Argument 1 of 10: "Hello there!"
- cout << "Argument " << i << " of " << argc << ": \"" << argv[i] << "\"" << endl;
- // Here we print this to let the person know that we're ending the program, and that they need to
- // press a key to continue.
- cout << "WE REACHED AN END! :D" << endl << "Press any key to quit...";
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement