Giter VIP home page Giter VIP logo

Palak Arora's Projects

ceaser-cipher-implementation icon ceaser-cipher-implementation

TASK 1: We're going to write a program which implements a very simple (almost useless) cypher algorithm. The algorithm works by adding the number 13 to every letter and (with wrapping so that 'Z'+1='A') will result in a new letter. Numbers are increased by 5 with wrapping so they remain just one digit. Other characters are left untouched. Your code must meet the following restrictions 1) Your program must use filenames that are given on the command line in the form of "php myprog.php 1 input.txt output.txt" (1 is the task number for this assignment). Your program MUST NOT crash if only one file name (or no file names) are given or if the input file doesn't exist. Likewise you should detect any error and generate a "nice" notice for the user. 2) The output will be the encoding of the input file. For our purposes the algorithm is defined as follows: A) If the input is a lower case letter, the output is the lower case letter plus 13 (with wrap-around, so 'n' becomes 'a') B) If the input is a upper case letter, the output is the upper case letter plus 13 (with wrap-around, so 'n' becomes 'a') C) If the input is a number the output is the number plus 5 (with wrap-around so '6' becomes '1') D) If the input is neither letter nor number, the output is the same as the input ('!' becomes '!' and ' ' becomes ' ') 3) If I execute the following (assumes 1.txt is a valid text file): "php myprog.php 1 1.txt 2.txt" "php myprog.php 1 2.txt 3.txt" Then 1.txt and 3.txt will have the exact same information 4) For this task, you may not use the str_rot13 function (that would be a little to easy). You may define your own functions, but you do not have to. TASK 2: The Caesar cypher is a simple cypher algorithm where each letter is assigned another letter in the alphabet. A table of corresponding letters is generated and stored. Your table will be stored in a associative array which you will access. Create an associative Array in which one character is mapped to another character Make sure no character is represented twice in either the keys or the values. for example you can use: $map= array ('a' => 'q'); not all characters must be represented! 1) Using the same format as above, your program will be run with an input filename and an output filename in the form of "php myprog.php 2 input.txt output.txt" (2 is the task number). Your program should read in the file and if any letters match those in the key of the array, they shoul dbe replaced with the corresponding letters in the value. 2) If the file contains a character which is not present in the array, you should leave the character alone.

file-system-checker icon file-system-checker

● Developed a file system using Java to support functions such as read, write, link, unlink.

nodeslide icon nodeslide

node.js related slideshows [deprecated], move to nodeslide.heroku.com

virtual-memory-simulation icon virtual-memory-simulation

Using PFF algorithm, decide if a new frame should be allocated based on the time since the last page fault.

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.