Not logged in. Log in with GitHub. About Websheets.

List of all available Websheets


Viewing cpp/sstreams/date by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
PropertyValue
Description
html markup
shown to student
 
Define a function <tt>date(string month, int day, int year)</tt>
that returns a <tt>string</tt> combining the elements in this format:
<pre>October 6, 1880</pre>
Public permissions remove
Engine
Template / Reference solution
 
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;
string date(string month, int day, int year) {
// return date in format like: October 6, 1880
\[
   return "hi";
]\
}
int main() {
   string date1 = date("December", 30, 1950);
   cout << boolalpha;
   cout << "date1 OK? " << ("December 30, 1950" == date1) << endl;
   
   cout << date("July", 4, 1776) << endl;
   cout << date("October", 6, 1880) << endl;
}
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 [{}]
 
[
   {}
]
Solution visibility remove


Optional properties:

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'.