Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Redo the programming assignment from Homework 1 in C++. Replace all C input/output statements with C++ statements (cin, cout, cin.getline) to get the same formatted

Redo the programming assignment from Homework 1 in C++. Replace all C input/output statements with C++ statements (cin, cout, cin.getline) to get the same formatted output as Homework 1.

Requirements:

Do not use the header file stdio.h, use iostream

Must contain a function called isDivisible with the following prototype:

void isDivisible( int, int, bool &);

Discuss and find how you will use the parameters.

You must compile your code using g++ command on UH Unix using the appropriate compilation options described on the course main page.

FAQ

For this assignment, I am prohibited from using stdio.h, but can I use other C header files, e.g., stdlib.h? - Yes, you can include them. You can also use specific forms to specifically include C header files, e.g., cstdlib

Do I need to submit a Makefile?

- No.

Do I need to consider a specific case for testing?

- No, just give an ordinary case to show that your program runs correctly.

Your submission must include the following:

Source Code

Proof of compilation

Output with ONE test case.

--------------------------------------------------------------

Homework 1 :

Contains a user-interface function which requests the user to enter a integer, and returns the given integer.

If the given value is a character or string, the program must display an error message and prompt the user to enter an integer. You only need to test for the input of characters and integers. You do not have to worry about floats being entered.

If the given number is less than or equal to 0, the program must display an error message and prompt the user to enter a positive integer.

Contains a print function which uses a for loop to generate a list of factors starting from 1 to the given number itself with indeces. (see the sample below)

Contains a function called isDivisible with the following prototype:

int isDivisible(int,int);

The table must be formatted. (see the sample below)

Columns must be right-aligned.

Please enter an integer to check its factors: 72

No. Factor
1 1
2 2
3 3
4 4
5 6
6 8
7 9
8 12
9 18
10 24
11 36
12 72

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

Vigor and persistence in pursuit of goals

Answered: 1 week ago