List of all available Websheets
Viewing cpp/var-expr/iomanip 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 | Read about I/O manipulators at <a href="http://en.cppreference.com/w/cpp/io/manip", target="_blank">this link</a>. Experiment with their usage. |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/var-expr/in_n_days (author: redekopp@usc.edu) Copied from problem cpp/var-expr/char_arith (author: redekopp@usc.edu) Copied from problem cpp/var-expr/hello (author: daveagp@gmail.com) |
Engine | |
Template / Reference solution |
using namespace std; int main() { // Experiment with the boolalpha manipulator \[ cout << "Bool values: " << boolalpha << true << " and " << false << endl; \show: cout << "Bool values: " << true << " and " << false << endl; ]\ // Experiment with the setw(n) and setfill(char) manipulator \[ cout << "Tabular values: " << endl; cout << setw(4) << 11 << setw(4) << 10 << setw(4) << 12 << endl; cout << setfill('.') << setw(4) << 8 << setw(4) << 7 << setw(4) << 5 << endl; \show: cout << "Tabular values: " << endl; cout << 11 << " " << 10 << " " << 12 << endl; // cout << setw(4) << 11 << setw(4) << 10 << setw(4) << 12 << endl; cout << 8 << " " << 7 << " " << 5 << endl; // cout << setfill('.') << setw(4) << 8 << setw(4) << 7 << setw(4) << 5 << endl; ]\ // Experiment with the fixed and setprecision(n) manipulator double pi = M_PI; \[ cout << setprecision(3) << fixed << pi << endl; cout << 1000*pi << endl; \show: cout << pi << endl; cout << 1000*pi << 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 [{}] | [ {"stdin":"", "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'.