Write a C++ program that will read one positive integer M supplied by the user, and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a C++ program that will read one positive integer M supplied by the user, and your program should output the number of all permutations of the digits, and the list of the permutations in an increasing order. If given input is 123 then your program should print an integer 6 with all 6 permutations in an increasing order e.g. 6 123 132 213 231 312 321 Note: If there are duplicated permutations, eliminate the duplicated one and only keep one permutations. For example, 121, will have 3 permutations which are 112 121 211. 11 If there are leading 0(s) in any permutation, eliminate the 0(s). For example, 120, will have permutations which are 12 21 102 120 201 210 Sample test case 3.1 Sample test case 3.2 123 6 123 132 213 231 312 321 Sample test case 3.3 121 3 112 121 211 Sample test case 3.4 120 6 12 21 102 120 201 210 Sample test case 3.5 100 3 1 10 100 Write a C++ program that will read one positive integer M supplied by the user, and your program should output the number of all permutations of the digits, and the list of the permutations in an increasing order. If given input is 123 then your program should print an integer 6 with all 6 permutations in an increasing order e.g. 6 123 132 213 231 312 321 Note: If there are duplicated permutations, eliminate the duplicated one and only keep one permutations. For example, 121, will have 3 permutations which are 112 121 211. 11 If there are leading 0(s) in any permutation, eliminate the 0(s). For example, 120, will have permutations which are 12 21 102 120 201 210 Sample test case 3.1 Sample test case 3.2 123 6 123 132 213 231 312 321 Sample test case 3.3 121 3 112 121 211 Sample test case 3.4 120 6 12 21 102 120 201 210 Sample test case 3.5 100 3 1 10 100
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Ice Cool produces two different models of air conditioners. The activities, costs, and cost drivers associated with the production processes follow. Budgeted Activity Usage 7,600 Activity Machining...
-
Dupré Company has the following items: cash in bank $17,500; payroll bank account $6,000; store cash floats $1,500; petty cash fund $250; short-term, highly liquid investments with maturity...
-
A BMW of mass 2.0 103 kg is traveling at 42 m/s. It approaches a 1.0 103 kg Volkswagen going 25 m/s in the same direction and strikes it in the rear. Neither driver applies the brakes. Neglect the...
-
In a properly planned financial statement audit, auditors typically coordinate tests of balance sheet and income statement accounts. For example, in practice auditors often coordinate tests of...
-
A university spent $1.8 million to install solar panels atop a parking garage. These panels will have a capacity of 500 kw, have a life expectancy of 20 years and suppose the discount rate is 10%. a....
-
a) Vectors a = (x 3-2) and b = (3-1 2) are 93.7 degrees apart. Solve for the highest value of x. (15 marks) b) Use Bresenham's algorithm to draw the line y = 0.5x+1 from (1,1) to (7,4). List the...
-
You own a flooring company that sells the following items. Product Premium Carpet Basic Carpet Luxury Vinyl Flooring Standard Vinyl Flooring Delivery Fee Installation Price $4.00 / square ft....
-
As consultants, we are hired to help the company track and report costs. The following Tableau Dashboard is provided to assist us in our analysis. Inventories Raw Materials Work in Process Finished...
-
For a single degree-of-freedom (SDOF) system with mass, damping, and stiffness, should the period (in sec) of the response in free vibration be computed based on the undamped natural frequency (wn)...
-
1. For feed media to a bioreactor, the dissolved oxygen concentration is proportional to that in the air surrounding the medium. The oxygen concentration will reach an equilibrium between the medium...
-
In the chemical equation A+ 3B -> 4C + 2D, how many molecules of C can form if 4 molecules of A react? 2. Balance the equation C8H18 + 02 -> H2O + CO2 3. 2Na(s) + Cl2(g) ~> 2NaCl (s) How many moles...
-
The feed to the bioreactor is oxygen gas and an aqueous solution of ammonia and glucose. The water (not including the ammonia and glucose dissolved in it) in the feed aqueous solution enters the...
-
= 1. Consider the case of channel flow where the top plate at y H is moving at a velocity of U and the bottom plate at y = 0 is moving with a velocity of Uo. We also impose a pressure gradient in the...
-
Current assets are $94,700. Accounts payable is $36,200, net income is $12,400 and sales are $110,800. What is the net working capital turnover rate?
-
The domain of the variable in the expression x 3/x + 4 is________.
-
Mary paid $2,000 of state income taxes in 2012. The total sales tax she paid during 2012 was $5,500, which included $3,000 for the cost of a new car. How should Mary treat the taxes paid on her 2012...
-
Mark owns his home and has a $250,000 mortgage related to his purchase of the residence. When his daughter went to college in the fall of 2012, he borrowed $20,000 through a home equity loan on his...
-
Brian and Kim have a 12-year-old child, Stan. For 2012, Brian and Kim have taxable income of $52,000, and Stan has nonqualifying dividend income of $4,500 and investment expenses of $250. No election...
-
The rotor of a dial indicator is connected to a torsional spring and a torsional viscous damper to form a single-degree-of-freedom torsional system. The scale is graduated in equal divisions, and the...
-
The equation of motion of a spring-mass-damper system, with a softening-type spring, is given by (in SI units) \[100 \ddot{x}+500 \dot{x}+10,000 x-400 x^{3}=0\] a. Determine the static equilibrium...
-
A wooden rectangular prism of cross section \(40 \mathrm{~cm} \times 60 \mathrm{~cm}\), height \(120 \mathrm{~cm}\), and mass \(40 \mathrm{~kg}\) floats in a fluid as shown in Fig. 2.111. When...
Study smarter with the SolutionInn App