1. Homepage
2. Programming
3. Computer Systems & Programming - Weekly Programming Exercises: Fibonacci Fish

# Computer Systems & Programming - Weekly Programming Exercises: Fibonacci Fish

Computer Systems & ProgrammingFibonacci FishSequence GeneratorC++ECE220CIT 595COMP201CS 367

# Weekly Programming Exercises

Following your lab 1 lab notes, attempt C/C++ coding for the following exercise questions. These exercise questions will help you practise coding objectively, in preparation for your coding projects.

1. Personalised greetings: Write a program that asks the user for their name(s) and the uses the clock time to issue a personalised greeting, as follows:

Good morning, Name. Good evening, Name.

2. Square Root: Using function(s), write a program that asks the user for a number, and then determines if the number has an integer squared root or not. e.g.

Example 1: Enter a number: 123 The number does not have an integer root.

Example 2: Enter a number: 64 The number has an integer root of 8.

3. Inverse Matrix: Write a program that asks the user for a matrix dimension and fills the matrix with random initial values. After that the program checks if the matrix can be inversed. If it is - it will then show the original and inverse matrices.

4. Least Common Denominator: Use function(s) to write a program that asks the user for a list of numbers and then finds out the least common denominator for the numbers.

5. Simple Encryption: Write a program (encrypt.cpp) to encrypt a message, which is an array of characters: char msg[25]="Very Important Message" (for example), declared and initialized in the main function. The message will be encrypted as follows:

Update each character's ASCII code (i.e. (unsigned int) msg[c], where c is the iterator) as

``            Current ASCII code = ((previous ASCII code * 9) % 96) + 31; ``

Implement the encryption through a function called do_encrypt(char []).Before and also after this encrypt operation, show the encrypted message on the standard console output through another function, called display_message(char []). Declare all the associated variables required.

6. Text Formatter: Write a program which can clean up bad spacing between words. For example, the following line:

"This is a badly spaced line entered by a user"

would look like the following:

"This is a badly space line entered by a user"

To allow for string inputs effectively, you can use the following

``````string a_line; // the string variable
getline (cin, a_line); // getline reads the entire line until carriage return is hit. ``````

7. Hangman: Create your personal dictionary of words using string arrays and then play a Hangman game with a user.

8. Fibonacci Fish: Did you know Fibonacci numbers? If you do not know, read about them. Within nature Fibonacci series manifests in very many forms, for example, the winter birds use Fibonacci series when they fly as a flock, some fish swim under water in a pattern using the Fibonacci series and sunflowers have their seeds organised in a Fibonacci series too. Write a program (fibonacci.cpp) that takes the series sequence number as an argument, generates the fibonacci numbers until the sequence and displays the number of fish in each line based on the fibonacci numbers in the series on the screen. For example, when you have 7 as the argument, it may produce a fish sequence like below:

><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> ><((°> > <((°>

You can use a function to draw the fish -- get some ideas from the characters above.

9. Fibonacci Fish with File: When you have a large number input as the sequence for Fibonacci, it can be difficult to display on the output console. Can you modify the program above and write the fish sequence in an output file called: fish.out? You can open this file as a text and use lower sized font settings to see a large sequence of fish.

10. Voltage Sweep in Power Computation: Power consumption in electronic circuits is given by: Power = Voltage Voltage Frequency; Write a program that takes three arguments as part of the main function: the lowest positive voltage (>0.3V), the highest positive voltage (<1.5V) and the linear step of voltage increase (as a double data type). The program should calculate the power at different voltages and frequencies and produce a CSV (comma separated values) file output (say power.csv) as follows (assuming the inputs as follows: ./main -lowvdd 0.35 -highvdd 1.2 -step 0.05). The 0 values entries should be filled in with the calculated values and the voltage rows will continue until the higher voltage value is reached.

Current voltage, Power@20M Hz, Power@40M Hz, Power@60M Hz, Power@ 80MHz, Power@100MHz

0.35, 0, 0, 0, 0, 0 0.40, 0, 0, 0, 0, 0 0.45, 0, 0, 0, 0, 0 0.50, 0, 0, 0, 0, 0

and so on When you have generated this output file, you can plot the power plot using Excel.

11. Least Common Denominator (re-visit question 4): Re-visit the question 4, this time break the program in multiple functions, and use variadic function (we will see examples this week) to allow for funding the least common denominator from an arbitrary number of parameters, e.g. lcd(2, 4, 7) or lcd(4, 5, 7, 9, 13). Make sure you have your functions in your own header file, and you are able to use them by including your header file/library.

12. PI computation: Did you know PI can be computed using the following series:

1 1 - 4 ( 1 -1 -3- + -5 - - 1 9 -...1

Write a program that can compute PI using a recursive function. Your recursive function will take number of series terms as the input (the above example shows 5 series terms until 1/9) and return the resulting PI value. Use functions and header files where you can.

13. The perimeter of Earth: Use the program you generated in Q 12 above to calculate the perimeter of the earth in meters (use the formula: 2 x PI x radius). Assume the earth has a radius of 6377768 meters and use the PI computation with 12 series terms as the most accurate reference for the PI value. Now find the errors (in meters) in perimeter calculation when lower number of series terms are used to approximate the nearest PI values. Computer Systems & Programming

14. Hangman Game with a dictionary file: Re-design your Hangman game with a dictionary file (made by you) to choose a word randomly and ask the user to guess the word one alphabet at a time. Have separate libraries and sources files for implementing the game. Total 6 guesses are allowed. Show a Hangman on display incrementally with more misses, like below: Guess the following word: an

15. Address Book: Use C/C++ structures to build an address book manager (e.g. first name, last name, phone number, date of birth and correspondence address). You should be able to add new records, delete existing records and list the records and sort them by any column within the address book.

16. Sequence Generator: Ask the user for a set of characters and then create a combination of all possible sequences of the characters -- sort the sequence alphabetically.

## Get in Touch with Our Experts

QQ
WeChat
Whatsapp
Computer Systems & Programming代写,Fibonacci Fish代写,Sequence Generator代写,C++代写,ECE220代写,CIT 595代写,COMP201代写,CS 367代写,Computer Systems & Programming代编,Fibonacci Fish代编,Sequence Generator代编,C++代编,ECE220代编,CIT 595代编,COMP201代编,CS 367代编,Computer Systems & Programming代考,Fibonacci Fish代考,Sequence Generator代考,C++代考,ECE220代考,CIT 595代考,COMP201代考,CS 367代考,Computer Systems & Programminghelp,Fibonacci Fishhelp,Sequence Generatorhelp,C++help,ECE220help,CIT 595help,COMP201help,CS 367help,Computer Systems & Programming作业代写,Fibonacci Fish作业代写,Sequence Generator作业代写,C++作业代写,ECE220作业代写,CIT 595作业代写,COMP201作业代写,CS 367作业代写,Computer Systems & Programming编程代写,Fibonacci Fish编程代写,Sequence Generator编程代写,C++编程代写,ECE220编程代写,CIT 595编程代写,COMP201编程代写,CS 367编程代写,Computer Systems & Programmingprogramming help,Fibonacci Fishprogramming help,Sequence Generatorprogramming help,C++programming help,ECE220programming help,CIT 595programming help,COMP201programming help,CS 367programming help,Computer Systems & Programmingassignment help,Fibonacci Fishassignment help,Sequence Generatorassignment help,C++assignment help,ECE220assignment help,CIT 595assignment help,COMP201assignment help,CS 367assignment help,Computer Systems & Programmingsolution,Fibonacci Fishsolution,Sequence Generatorsolution,C++solution,ECE220solution,CIT 595solution,COMP201solution,CS 367solution,