7.6 Graph animation 231
return 0;
}The three dots indicate previously listed blocks of code.
When the graph is drawn on the screen, the program waits for a key to
be pressedwhile the cursor is on the graphics window. When the “q” key is
pressed, the program issues a prompt for postscript drawing options and file
name. If any other key is pressed, the execution quits.
Problems
7.5.1. Run codeplot2dto produce a postscript file containing the graph of a
function of your choice.7.5.2. Modify codeplot2dto allow for multiple functions printed on the same
graph with different colors.7.6 Graph animation
As a further application, we discuss a code contained in the filegraph2danm.cc
that animates a specified time-dependent function:
/*------------------------
graph2danm.ccAnimate an evolving function
-------------------------*/#include<iostream>
#include<cmath>
#include "VOGLE/voglec++.h"
#include "drawmarker2d.h"
#include "drawline2d.h"
#include "drawaxes2d.h"using namespace std;char kbd;int main()
{
float points[4][2];//--- Define the data:const int n=32;