Write an entire c++ program that reads a positive integer

Assignment Help C/C++ Programming
Reference no: EM13338990

Write an entire C++ program that reads a positive integer entered by an interactive user and then prints out all the positive divisors of that integer in a column and in decreasing order. The program should allow the user to repeat this process as many times as the user likes. Initially, the program should inform the user about how the program will behave. Then the program should prompt the user for each integer that the user wishes to enter.

The program may be terminated in any of two ways. One way is to have the program halt if the user enters an integer that"s negative or zero. In this case the user should be reminded with each prompt that the program can be terminated in that way. Alternatively, after an integer has been entered and the divisors have been printed, the program can ask the user whether he/she wishes to enter another integer. In this case, when the user accidentally enters a zero or negative integer to have its divisors calculated, the program should inform the user that the input is unacceptable and should allow the user to try again (and again!).

Here is an illustration of how the program and the interactive user might interact. The user"s responses to the program are shown in bold italics. This program is designed to exhibit the positive divisors of positive integers supplied by you. The program will repeatedly prompt you to enter a positive integer. Each time you enter a positive integer, the program will print all the divisors of your integer in a column and in decreasing order.

Please enter a positive integer: 36
36
18
12
9
6
4
3
2
1

Would you like to see the divisors of another integer (Y/N)? y
Please enter a positive integer: -44
-44 is not a positive integer.
Please enter a positive integer: 0
0 is not a positive integer.
Please enter a positive integer: 109
109
1

Would you like to see the divisors of another integer (Y/N)? m
Please respond with Y (or y) for yes and N (or n) for no.
Would you like to see the divisors of another integer (Y/N)? n

Reference no: EM13338990

Questions Cloud

What is the volume of the secret cavity : A small sculpture made of brass (rbrass = 8470 kg/m^3) is believed to have a secret central cavity. What is the volume of the secret cavity
How many integer values are in the array : Write a function named "location_of_largest" that takes as its arguments the following.
What is the acceleration of gravity on this planet : You have just landed on a planet. You take out a block of mass 245g , release it from rest from a height of 14.01m, What is the acceleration of gravity on this planet
Determine the loss rate of particles from jeans escape : Determine the flux of particles escaping from the exobase of Earth's atmosphere using a number density at the exobase of 10^5 particles/cm^3 and a temperature of 700K.
Write an entire c++ program that reads a positive integer : Write an entire C++ program that reads a positive integer entered by an interactive user and then prints out all the positive divisors of that integer in a column and in decreasing order.
Estimate how far from site of impact resulting shock front : Suppose a 100m diameter stony (p= 3 g/cm^3) meteroid impacts the Earth with a speed of 20km/s. Assume all kinetic energy goes into the creation of an atmospheric blast wave.
Find the speed of the car at the top of the circle : A roller coaster shown below is built in your town. The radius of the circular part is 20 meters. As a physics student, you are invited to take the first ride. Find the speed of the car at the top of the circle
Calculate the emission temperature of the earth : calculate the emission temperature of the earth, if the planetary albedo is changed to that of ocean areas without clouds, about 10%
The ideas of others and synthesizing those ideas : Since this class is centered on the practice of working with the ideas of others and synthesizing those ideas into our own writing

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Converts the temperature f in farenheit to c in celsius

Write a program that converts the temperature F in Farenheit to C in Celsius using C = (F-32)*5/9. For ease of programming you can display the result in fractions.

  We base our need to implement composition upon

What criterion, or criteria, should be used to include objects of a class as data members of another class? In other words, what should we base our need to implement composition upon?

  One time for the entire number set

You must run your program one time for the entire number set. Test for EOF (or use the function feof()) to know when to stop processing. You are to determine if each integer read is prime or not, and output the result to stdout

  C programme to find the minimum and maximum value

write a c programme to find the minimum and maximum value each elements in each row ,to create table b,having 5 rows and 2 coloums,the first coloum of table b is the maximumvalue and thye second coloum is the maximum value in each row.

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  Use a for loop to generate 100 random numbers.

Use a For Loop to generate 100 random numbers. Determine the most current maximum and minimum number as the random numbers are being generated. This is referred tp as a "running" maximum and minimum. Display the running maximum and minimum values as ..

  Static field holds total winnings for all horses in stable

static field holds total winnings for all horses in the stable // total winnings are shown after each horse wins,

  In c++, write a program that calculates 10,000 tries.

In C++, write a program that calculates 10,000 tries. These tries are based upon a rat trying to escape from a maze. Keep adding minutes until the rat is free and when he is free that is 1 try so we need 10,000. We start by randomly generating a numb..

  State a c program that opens the file

Write a C program that opens the file and firstly stores all the values in an appropriately declared two-dimensional array of integers. It then should analyse this array to find (from the 40 input values) the total number of coursework marks in the..

  Using an abstract class with only pure virtual functions

Using an abstract class with only pure virtual functions, create three small classes unrelated by inheritance---clases Building, Car and Bicycle. Give each class some uique appropriate attributes and behaviors that it does not have in common with oth..

  Write a function to arrange 10 numbers stored in an arraye

Writ a funtion to arrange 10 numbers stored in an array forom the largest to the smallest and pass the results to main program.

  Analyze the time complexity and space complexity

Develop a simple prototype version of algorithm in C++. Specifically, you will build an in-place, order reversal algorithm - analyze the time complexity and space complexity of your algorithm

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd