Git Product home page Git Product logo

assignment4's Introduction

Assignment 4

Objectives

To gain a solid understanding of arrays and strings.

Part 1

  1. Given an array of n integers where n > 1, return an array of same size an input array where at every index of the output array should contain the sum of all elements in the array except the element at the given index. You can have it so that the array is input by the user.

  2. Write a program that takes an array as input, removes duplicates, and outputs that array.

  3. Write a program that takes a string of characters and returns the frequency of each character in that string. For characters not in the string, nothing should be printed. For instance, for input “Aabcvbc”, you should print

A = 1
a = 1
b = 2
c = 2
v = 1

You may assume the string will be all letters and that the length of the input string does not exceed 100. Try to be as efficient as possible.

  1. Write a program implementing the Hangman game. You may hardcode a word for the user to guess. The program should display blanks for each letter and fill those blanks as the user guesses correctly. The program should also display the bank of incorrectly guessed letters and have a limited number of allowed incorrect guesses before the player loses the game.
    Optional challenge: create a set of words and have the game randomly choose one each time 
    Optional challenge: prompt the user to play again
    Optional challenge: include ascii art corresponding to the hangman game that updates each time the user guesses incorrectly

Part 2

In a text file assignment4.txt, answer the following questions:

  1. Discuss the differences between strings and a character array.
  2. Explain the advantages and disadvantages of arrays in C.
  3. When does the compiler not implicitly generate the address of the first element of an array?
  4. How would two strings be compared to see if they’re equivalent in content?

Submission Guidelines

Please include your name and a description in a comment at the top of your code files. Please also include your name at the top of your assignment4.txt file.

All files must be submitted via GitHub by 10:00am 7/5.

assignment4's People

Contributors

clesleycode avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.