tsimpleplotxy.cpp

来自「crack modeling with xfem」· C++ 代码 · 共 81 行

CPP
81
字号
/* 2008 (c) Dorival M. Pedroso */// STL#include <iostream>// FLTK#include <FL/Fl.H>#include <FL/Fl_Double_Window.H>// Local#include "array.h"#include "plotxy.h"#include "fatal.h"///////////////////////////////////////////////////////////////////// MainWindow /////// MainWindowclass MainWindow : public Fl_Double_Window{public:	// Constructor	MainWindow(int wid=420, int hei=320) : Fl_Double_Window (wid,hei,"Test PlotXY")	{		// Add widgets to window		begin();			// Widgets			_wp = new PlotXY (/*xmin*/10,  /*ymin*/10,  /*width*/400, /*height*/300,			      "Simple PlotXY", "The X", "The Y");		end();		// Calculate coordinates		for (int i=0; i<=20; ++i)		{			_X.Push(i);			_Y.Push(i*i);		}		// Add curve to plotXY		_wp->AddCurve (&_X, &_Y, "XY");		_wp->SetCurve (0).Clr = FL_BLUE;		// Set resizable and show window		resizable (this);		show      ();	}private:	// Widgets	PlotXY * _wp;	// Variables	Array<double> _X;	Array<double> _Y;}; // class MainWindow/////////////////////////////////////////////////////////////////////////// main /////int main(int argc, char **argv) try{	MainWindow win;	Fl::run();	return 0;}catch (Fatal * e){	e->Cout();	delete e;	exit(1);}catch (char const * m){	std::cout << "Fatal: " << m << std::endl;	exit (1);}catch (...){	std::cout << "Some exception (...) ocurred\n";}/* 2008 (c) Dorival M. Pedroso */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?