When you are trying to represent the behavior of some quantity that varies over
ID: 3557701 • Letter: W
Question
When you are trying to represent the behavior of some quantity that varies over time, one of the usual tools is the line graph, in which a set of data values are plotted on an x-y grid with each pair of adjacent points connected by a straight-line. For example, given the following set of 10 points: (0.0, 0.67) (0.4, 0.68) (0.8,0.71) (1.2,0.86) (1.6,0.86) (2.0,1.30) (2.8,1.81) (3.2,1.46) (3.6,1.86)
Write a function DrawLineGraph that generates a line graph given an array of x-coordinate values, a second array of corresponding y-coordinate values, and the number of data points.
Explanation / Answer
#include <iostream>
#include "koolplot.h"
using namespace std;
int main()
{
int x[20], y[20], n
cout << "Enter the number of data points to be used"
cin >> n;
cout << "Enter x values";
for(int i=0, i<n, i++)
{
cin >> x[i];
}
cout << "Enter y values";
for(int i=0, i<n, i++)
{
cin >> y[i];
}
for(int i = 0, i<n, i++)
{
addMarx(x[i], y[i], xCoord, yCoord);
}
plot(x, y);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.