out: Monday, October 13, 2025
due: Wednesday, October 15, 2025 by 10:00 am,
No late exercises accepted.
Goals: Write a small procedural (no
classes or objects) C++ program from scratch,
learn the basics of C++ stream I/O,
and learn to use the cpplint style checker for C++ code.
Description: Write a C++ program that:
n%k==0),
and you should print each
factor only once, in ascending order.
For example, if the user enters the number 100,
the interaction with the terminal should look like:
If you wish, the last output number can be followed by a blank space before the newline, although it's not needed.bash$ ./ex8 Which positive integer would you like me to factorize? 100 1 2 4 5 10 20 25 50 100 bash$
std::cin to read from the terminal and
std::cout to write to the terminal
Your code must:
ex8.cc
that compiles with the command g++ -Wall -g -std=c++17 -o ex8 ex8.cc -- do
not submit a Makefile.cpplint style checker,
but without the --clint option, which is for C code.using namespace directive in
your code if you don't want to write std::
everywhere for short exercises like this, even if
cpplint complains about it.
You can also use individual using std::... directives,
which do conform to the style guide.)
The class discussion group is a good place for questions and discussion about these issues.
You should submit your exercise using the Gradescope dropbox linked on the course resources web page.