Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you please help me with this project? Project 6 1. (70 points) One way to encode a word is to split it into two
Can you please help me with this project?
Project 6 1. (70 points) One way to encode a word is to split it into two sets of characters one by one and merge the second set before the first set one by one. Write a C program encode.c that implements this algorithm. For example, a word defend will be split into two sets of characters: dfn and eed. Merging the two sets of characters one by one with the second set before the first set will result in: edefdn The two sets will be either the same length (when the input word has even number of characters) or the first set will be one character longer than the second set (when the input word has odd number of characters). If the first set is longer than the second set, the last character in the first set will be appended to the result. For example Enter a word: merging Output: emgrnig Your program should include the following function void encode (char *s1, char "s2); The function expects s2 to point to a string containing a string that is converted from 1) Assume each input is no longer than 1000 characters 2) The encode function should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of 3) To read a line of text, use the read line function (the pointer version) in the 2. (30 points) Write a program that test whether there are three numbers with the same the [ operator in the function lecture notes value in its command-line arguments, which are assumed to be integers. Example runs of the program: ./a.out 5 2 92 424 53 42 67 output: command-line arguments does not contain three numbers with the same value ./a.out 41 8 41 23 41 38 output: There are three numbers with the same value in the command-line arguments 41 1) Name your program command line.c 2) Use the three_numbers function in project 4 3) Use atoi function in
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started