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

List of all available Websheets


Viewing cpp/division-modulo/building-floor 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
 
Buildings generally assign office and suite numbers based on which floor they are on.  
In many cases the last 2 digits identify the room or suite while the remaining upper digits identify the floor
(e.g. room 632 is on floor 6, room 2281 is on floor 22).
Write a program that take as input the room/suite number and then outputs the floor number where the room/suite is located.
Public permissions remove
Remarks
Comments, history, license, etc.
 
Copied from problem cpp/cin/building_floor (author: redekopp@usc.edu)
Copied from problem cpp/cin/average (author: redekopp@usc.edu)
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)
remove
Engine
Template / Reference solution
 
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
   // variable for the room/suite number
   \[
   int room;
   ]\
   cout << "Enter the room/suite number: " << endl;
  \[
   cin >> room;
  ]\
   
   
  cout << "Room " << room << " is on floor " << \[ room / 100 ]\ << 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":"632", "args":[]},
   {"stdin":"2236", "args":[]},
   {"stdin":"10499", "args":[]},
   {"stdin":"100", "args":[]}
   
]
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'.