Question: Can you show me how to form a c program for task 2. The output is given below. Task 1 create a function called cubic,
Can you show me how to form a c program for task 2. The output is given below.
Task 1
- create a function called cubic, which takes an integer X as input and returns a float Y as the output, satisfying the equation
Y = 1000X - 30000X + 200000X + 500000
- create a int array of size 21 that contain data of cubic(0) to cubic(20)
- print the table of X and Y values from the array data.
Task 2
- create a function called graph, which takes a pointer to int called table as the input, and display a graph that satisfy the following criteria:
- vertical axis(y-axis) is represented by |
- horizontal axis (x-axis) is represented by -
- origin is represented by +
- line of graph is represented by %
- each column(x-axis) represent 1 unit
- each row(y-axis) represent 50000 units, for example:
| row 2: from 50001 to 100000
| row 1: from 1 to 50000
| row 0: x-axis, all use - except x-intercept use %
-
- only need to show graph of x-value from 0 to 20 inclusive, and y-value from 0-1000000
- x or y intercept is showed as % instead of - if any
- 2 space is padded between each column of the graph, but for x-axis whole line use -
- pass the pointer to data as input to the function graph.
- Output:
+---+-------+ | X1 YT +---+--- + | 0 5000001 | 1 6710001 | 2 | 788000 | 3 8570001 | 4884000 | 5 875000 | 6 836000 | 7| 7730001 | 8 6920001 | 9 599000 | 10 500000 | 11 4010001 | 12 3080001 | 13 227000 | 14 1640001 | 15 | 125000 | 16 | 116000 | 17| 143000 | 18 212000 | 19 329000 | 20 500000 +---+------ + 1 | 1 % % % % I % I | % % . I % . % % % 1 1 % % % % % % % % % | +
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
