⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 magicdemoapp.cs

📁 是“MATLAB混合编程与工程应用”一书的源码
💻 CS
字号:
// *******************************************************************************//// MagicDemoApp.cs//// This file is an example application for the MATLAB Builder for .NET product.//// Copyright 2001-2005 The MathWorks, Inc.//// *******************************************************************************using System;using MathWorks.MATLAB.NET.Utility;using MathWorks.MATLAB.NET.Arrays;using MagicDemoComp;namespace MathWorks.Demo.MagicSquareApp{	/// <summary>	/// The MagicSquareApp demo class computes a magic square of the user specified size.  	/// </summary>	/// <remarks>	/// args[0] - a positive integer representing the array size.	/// </remarks>	class MagicDemoApp	  {      #region MAIN		  /// <summary>		  /// The main entry point for the application.		  /// </summary>		  [STAThread]		  static void Main(string[] args)		    {          MWNumericArray arraySize= null;           MWNumericArray magicSquare= null;          try            {              // Get user specified command line arguments or set default               arraySize= (0 != args.Length) ? System.Double.Parse(args[0]) : 4;              // Create the magic square object              MagicSquare magic= new MagicSquare();              // Compute the magic square and print the result              magicSquare= (MWNumericArray)magic.makesquare(arraySize);              Console.WriteLine("Magic square of order {0}\n\n{1}", arraySize, magicSquare);              // Convert the magic square array to a two dimensional native double array              double[,] nativeArray= (double[,])magicSquare.ToArray(MWArrayComponent.Real);              Console.WriteLine("\nMagic square as native array:\n");              // Display the array elements:              for (int i= 0; i < (int)arraySize; i++)                 for (int j= 0; j < (int)arraySize; j++)                  Console.WriteLine("Element({0},{1})= {2}", i, j, nativeArray[i,j]);              Console.ReadLine();  // Wait for user to exit application            }          catch(Exception exception)            {              Console.WriteLine("Error: {0}", exception);            }        }      #endregion	  }}  

⌨️ 快捷键说明

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