List of all available Websheets
Viewing cpp/pointers/cmdargs_ptr_ex by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | Predict what will be output if the program is run as: <pre><b>$</b> ./cmdargs_ptr_ex cs103 cmd line args</pre> |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/pointers/hello (author: daveagp@gmail.com) |
Engine | |
Template / Reference solution |
using namespace std; // main should accept command-line arguments int main(int argc, char* argv[]) { \[ cout << "argc = " << argc << endl; cout << "argv[1] = " << argv[1] << endl; cout << "*(argv + 3) = " << *(argv + 3) << endl; cout << "argv[2][1] = " << argv[2][1] << endl; cout << "*(argv[1] + 4) = " << *(argv[1] + 4) << endl; \show: cout << "argc = " << argc << endl; cout << "argv[1] = " << argv[1] << endl; cout << "*(argv + 3) = " << *(argv + 3) << endl; cout << "argv[2][1] = " << argv[2][1] << endl; cout << "*(argv[1] + 4) = " << *(argv[1] + 4) << endl; ]\ return 0; } |
C++ test suite json list of stdin/args tests e.g. [{"stdin":"hi", "args":["4", "5"]}, {"stdin":"noargs"}] to just run once with no input use [{}] | [ {"args": ["cs103","cmd","line","args"]} ] |
Solution visibility | |
Is example? i.e., just a demo |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.