E15 fundamentals of digital systems - fall 2010 - homework


E15: Fundamentals of Digital Systems - Fall 2010 - HOMEWORK 10

1) Write a program called nprimes which takes a single integer input n on the command line. It should produce as output the first n prime numbers, one on each line. For example, running "nprimes 4" should produce the output 2 3 5 7, with each number on its own line.

2) Write a program called stats which takes its input from either a file named on the command line, or from standard input. The input should consist of real numbers, both positive and negative, separated by spaces and/or newlines. The program's output should consist of three lines: the first line should print the minimum number input, the second should print the maximum, and the third should print the average of all the numbers input.

Use the %g or format specifier to print the min, max, and average. The program should generate an error if the input contains no numbers.

3) Write a program called bigsum which can sum a set of numbers larger than the maximum long integer size (about 19 decimal digits). Your program should take its input either from a file named on the command line, or from standard input. The input should consist of nonVnegative integers of up to 32 digits, separated by spaces and/or newlines. The output is a single number equal to the sum of all of the inputs. Your program should generate an error if any input is longer than 32 digits, or if the output cannot be stored in a 32 digit number.

4) Write a program called wordsearch which takes its input either from a file named on the command line, or from standard input. The input should consist of two parts: first, a block of m lines of n uppercase letters, with m and n both less than 256; then a single blank line, followed by a set of words to search for, one on each line, in upper or lower case. Each word should be hidden within the original block of text, horizontally, vertically, or diagonally, forwards or backwards. Your program should output for each word, the starting and ending row and column where the word can be found, with (0, 0) being the topVleft position, or indicate whether the word was not found.

Attachment:- homework10.zip

Request for Solution File

Ask an Expert for Answer!!
Other Engineering: E15 fundamentals of digital systems - fall 2010 - homework
Reference No:- TGS01479162

Expected delivery within 24 Hours