For this task you are asked to write a program that consists of a le recap.cpp and a
makele to compile and run it. You will need to include a blank data.txt le in your
submission as well. Your makefille must compile the executable as main. You are required to read this data, line by line, into a 2D dynamic array of strings.
The format of the line is as follows:
1,a,b,c,d
Each line starts with an ID, which is an int, and then will be followed by an unknown
number of strings separated by commas. Each string in the line is associated with the ID
of the line. Each line will have at least the ID and 1 item.
Once the items are stored in the array you need to print out the array in ascending order
based on the order IDs in the following format:
ID,a,b,c
An example of this output is as follows (for 2 orders):
3,toaster,iron
4,spanner,wrench,hammer
Terminate each line of output with a newline.
The following libraries are allowed:
- iostream
- fstream
- string
- sstream
Definition
For this question we have to write MATLAB code to detect a scalene triangle by reading in three numerical values representing the lengths of the three sides and printing “it’s a scalene” if the triangle is not an isosceles or equilateral triangle and the sum of any two side’s length is greater than the length of the other side.
Testing
On paper, or in a text file, write three new tests for the above program. As an example, three tests for this program might be.
inputs output
5 5 5 <no output>
2 1 2 <no output>
3 2 1 <no output>
3 4 5 “it’s a scalene”Coding
If you are sharing a computer, swap a new group member to the terminal. Write a MATLAB script called q6.m that implements the definition above using at least if-statements.
Definition:
In this question we define code that reads in three positive numbers representing the lengths of the sides of a triangle and prints out a message saying “it’s equilateral” if all three sides are of equal length.
Testing:
On paper, or in a text file, write three new tests for the above program. As an example, two tests for this program might be.
inputs output
5 5 5 “it’s equilateral”
2 1 2 <no output>Prefix Suffix
Write a program to check the overlapping of one string's suffix with the prefix of another string.
Input
The first line of the input will contain a string A.
The second line of the input will contain a string B.
Output
The output should contain overlapping word if present else print "No overlapping".
Explanation
For example, if the given two strings, A and B, are "ramisgood" "goodforall"
The output should be "good" as good overlaps as a suffix of the first string and prefix of next.
Sample Input 1
ramisgood
goodforall
Sample Output 1
good
Sample Input 2
finally
restforall
Sample Output 2
No overlapping