Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions: C+ a) Use scanf function to accept the input from the user. b) Use floating point inputs wherever possible c) All programs must use
Instructions: C+ a) Use scanf function to accept the input from the user. b) Use floating point inputs wherever possible c) All programs must use arrays and functions d) Tabulate your results e) Need hard copy of (i) source code and (ii) output for each program. 1. Redo the Sum of sinusoids program (using functions) that we did in Lab 7. Plot the individual sinusoids and also the sum sinusoid in a single figure. Also, calculate the maximum height attained by the sum sinusoid. Also provide a legend on the graph. Label the x and y axes and provide a title 2. Redo the flight simulator program (using functions) that we did in Lab 7. Plot the wind speed when (a) there is no storm, (b) when there are 3 storms with varying intensities. You can choose the time between which storms occur 3. Use arrays to read the following input file: 30.0 45.0 60.0 90.0 2 4 Then process the data and generate the following file NX (degree) cos(X) 30.0 45.0 60.0 90.0 0.8667 0.7071 0.5 0.0 2 4 [Hint: Read the array element in the main function, pass the array to a user defined function named array process and compute cos(X) and print the above table inside the function. The function may have a return type void] 4. A 1-D array has these ten elements 4.4 3.3 2.2 5.5 1 6.6 7.710.0 9.98.8 Use a function named descending order which will accept this array and sort the array in descending order. The function may have a return type void 5. Write a program that can calculate the sum of three equally sized matrices, [A B1 + [C]. The input specifications are these Read the input from a file with the first line of the file being the number of rows and columns of each matrix. The rest of the file has the elements of the matrices. The output specification is to print the sum matrix. [Hint: Use a function named sum matrices to accept the 3 matrices and print the sum matrix inside the function] Instructions: C+ a) Use scanf function to accept the input from the user. b) Use floating point inputs wherever possible c) All programs must use arrays and functions d) Tabulate your results e) Need hard copy of (i) source code and (ii) output for each program. 1. Redo the Sum of sinusoids program (using functions) that we did in Lab 7. Plot the individual sinusoids and also the sum sinusoid in a single figure. Also, calculate the maximum height attained by the sum sinusoid. Also provide a legend on the graph. Label the x and y axes and provide a title 2. Redo the flight simulator program (using functions) that we did in Lab 7. Plot the wind speed when (a) there is no storm, (b) when there are 3 storms with varying intensities. You can choose the time between which storms occur 3. Use arrays to read the following input file: 30.0 45.0 60.0 90.0 2 4 Then process the data and generate the following file NX (degree) cos(X) 30.0 45.0 60.0 90.0 0.8667 0.7071 0.5 0.0 2 4 [Hint: Read the array element in the main function, pass the array to a user defined function named array process and compute cos(X) and print the above table inside the function. The function may have a return type void] 4. A 1-D array has these ten elements 4.4 3.3 2.2 5.5 1 6.6 7.710.0 9.98.8 Use a function named descending order which will accept this array and sort the array in descending order. The function may have a return type void 5. Write a program that can calculate the sum of three equally sized matrices, [A B1 + [C]. The input specifications are these Read the input from a file with the first line of the file being the number of rows and columns of each matrix. The rest of the file has the elements of the matrices. The output specification is to print the sum matrix. [Hint: Use a function named sum matrices to accept the 3 matrices and print the sum matrix inside the function]
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