//************************************ // By Ive 4, June 4 * //************************************ #include #include "xyplotwindow.h" #include using namespace std; /// \fn void illustration(int paramValue, int ¶mRef) /// \~English /// \brief This function is to illustrate the difference between /// pass by value and pass by reference /// \param paramValue parameter passed by value /// \param paramRef parameter passed by reference /// \~Spanish /// \brief Esta funcion es para ilustrar la differencia entre /// variables pasadas por referencia y pasadas por valor /// \param paramValue parametro pasado por valor /// \param paramRef parametro pasado por referencia void illustration(int paramValue, int ¶mRef) { paramValue=1; paramRef=1; cout << endl << "The content of paramValue is: " << paramValue << endl << "The content of paramRef is: " << paramRef << endl; } /// \fn void circle(double p, double &xCoord, double &yCoord) /// \~English /// \brief Function to draw a circle /// \~Spanish Funcion para dibujar un circulo void circle(double p, double &xCoord, double &yCoord) { xCoord = 5 * cos(p); yCoord = 5 * sin(p); } //Overloaded Funcion circle / Funcion circulo sobre cargada // YOUR CODE HERE / TU CODIGO AQUI ///************************************ ///Function butterfly * ///************************************ // YOUR CODE HERE / TU CODIGO AQUI //*************** // Function main * //*************** int main(int argc, char *argv[]) { QApplication a(argc, argv); XYPlotWindow wCircleR5; XYPlotWindow wCircle; XYPlotWindow wButterfly; double r; double y = 0.00; double x = 0.00; double increment = 0.01; int argValue=0, argRef=0; // invoke the function illustration to view the contents of variables by value and by reference // invoca la funcion ilustracion para ver los contenidos de variables por valor y por referencia illustration(argValue,argRef); cout << endl << "The content of argValue is: " << argValue << endl << "The content of argRef is: " << argRef << endl; // repeat for several values of the angle t // repite para varios valores de el angulo t for (double t = 0; t < 16*M_PI; t = t + increment) { // invoke circle with the angle t and reference variables x, y as arguments // invke circle con el angulo t y variables por referencia x, y como argumentos circle(t,x,y); // add the point (x,y) to the graph of the circle // anade el punto (x,y) a la grafica de el circulo wCircleR5.AddPointToGraph(x,y); // invoke circle with the radius r, the angle t and reference variables x, y as arguments // invoca circulo con el radio r, el angulo t y variables x, y como argumentos // YOUR CODE HERE / TU CODIGO AQUI // add the point (x,y) to the graph of the circle // anade el punto (x,y) to la grafica de el circulo // YOUR CODE HERE / TU CODIGO AQUI // invoke butterfly with the angle t and reference variables x, y as arguments // invoca butterfly con el angulo t y variables referencia x, y como argumentos // YOUR CODE HERE / TU CODIGO AQUI // add the point (x,y) to the graph of the butterfly // anade el punto (x,y) a la grafica de la mariposa // YOUR CODE HERE / TU CODIGO AQUI } // After all the points have been added, plot and show the graphs // Despues que todos los puntos sean anadidos, enseƱa las graficas. wCircleR5.Plot(); wCircleR5.show(); // YOUR CODE HERE / TU CODIGO AQUI. return a.exec(); }