Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this assignment is to refamiliarize you with the Unix C++programming environment and the method to be utilized when submitting an assignment for

image text in transcribedimage text in transcribed

The purpose of this assignment is to refamiliarize you with the Unix C++programming environment and the method to be utilized when submitting an assignment for grading. Multiplying the digits of an integer and continuing the process gives the surprising result that the sequence of products always arrives at a single-digit number. For example, 71535 15 5, 88- 64 24 8, 27 14 4, etc. The num ber of products necessary to reach the single-digit is called the persistence number of that integer. Thus, 715 and 88 have persistence 3, while 27 has persistence 2. Write a program that wi read an unknown number of unsigned ints from the standard input device (input can terminate when the end-of-data marker is encountered). For each input number, determine its persistence. In addition to printing the original nmber and its persistence, also print the intermediate products. The output should be formatted as shown below. The output should be directed to the standard output device. A sample execution sequence is in Figure 1. To use the Makefile as distributed in class, add a target of lab01 to targets1srcfile. 22 newuser@csunix "/2336/01> cat 01.dat 23 715 24 88 25 27 2 100 2 2147483647 28 2147483648 29 999 30 1234 112345 32 123456 33 1234567 34 12345678 35 123456789 a6 1234567890 37 newuser@csunix "/2336/01> cat 01.dat I ./1ab01 8 Your Name-CS 2336 Lab 01 40 71535 - 15-5 persistence3 41 88-> 64-> 24-> 8 persistence 3 42 27-> 14-> 4 persistence 2 43 100 - 0 persistence1 44 2147483647 ->903168 - 0 persistence2 45 2147483648 - 1032192- 0 persistence 2 46 999-> 729-> 126-> 12-> 2 persistence 4 47 1234-> 24-> 8 persistence 2 48 12345 120 - 0 persistence 2 49 123456 720 - 0 persistence 2 50 1234567 - 5040 0 persistence-2 51 12345678 ->40320 -0 persistence2 52 123456789 3628800 persistence-2 53 1234567890-0 persistence-1 4 newuser@csunix /2336/01> cat 01.dat ./lab01 > my.out 55 newuserQ 56 newuserQcsunix /2336/01> csunix /2336/01> diff 01.out my

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

Ty e2y Evaluate the integral dy

Answered: 1 week ago