Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ./manipulator [-i]|[-f file1 file2] [-h]
- This program is a string and numbers manipulator and provides following fuctions:
- base1_2_base2 : Converts a number in base1 to appropriate representation in base2
- Usage: base1_2_base2 base1 base2 number
- base1 = The source base between 2 and 16
- base2 = Destination base between 2 and 16
- number = The number in base1
- Output: Prints the representation of the input number in base2
- hexadec_2_bit : Takes a hexadecimal number and checks which bits have been turned ON
- Usage: hexadec_2_bit number
- number = A hexadecimal number as input
- Output: Prints which all bits are switched on among the initial 10 bits
- Ignores all the bits after the 10th bit. Bits are numbered from right
- Bit-Mapping: 1 1 1 1 1 1 1 1 1 1
- J I H G F E D C B A
- fibonacci_ser : Takes an number and prints the fibonacci series for that number using recursion
- Usage: fibonacci_ser number
- number = An integer
- Output: The comma seperated fibonacci series corresponding to the input number
- reverse_strng : Takes a string and prints that string in reverse order
- Usage: reverse_string string
- string = Some string which can include special character and alphanumerics
- Output: Prints the input string in reverse order
- remove_spaces : Takes a string and removes all extra whitespaces (space and TAB characters)
- Usage: remove_spaces string
- string = Some string with extra whitespaces (space and TAB charcters) in it
- Output: Prints the string back with all extra spaces removed
- character_frq : Takes a string and prints the character frequency for all the characters in it
- Usage: character_frq string
- string = Some string
- Output: A comma seperated list of character count in the given input string
- cipher_string : Takes a string and ciphers it by shifting and rotating characters
- Usage: cipher_string shift_int rotate_int string
- shift_int: An integer between -9 and 9
- A negative integer means shift left and positive means shift right
- rotate_int: An integer between -9 and 9
- A negative integer means reverse rotation and a postivie means forward rotation
- string: Some input alphanumeric string
- Output: The ciphered string after shifting and rotations
- exit_program_ : Quits the program
- Usage: exit_program_
- The command line arguments accepted for this program are as follows:
- -i : To run the program interactively and read the input from stdin
- -f file1 file2: To read the program inputs from a file1 and output to file2.
- Only one of -i or -f should be used. If both are present it gives preference to interactive mode
- -h : To print this help
Add Comment
Please, Sign In to add comment