C# 转换类,支持 C++ 等






1.16/5 (11投票s)
2004年5月28日
1分钟阅读

55526

490
ConvertTo、Math、Stack 类,让您在使用 C++ 6.0 时更加轻松。
引言
Using
要使用此 LIB,请将其粘贴到您的解决方案文件夹中。然后在 VC++6.0 菜单中(项目 -> 设置)
在“链接”选项卡中的“(对象/库模块)”框中,输入库的名称,例如 (CSharp.lib)
然后使用“添加文件到项目”将头文件添加到您的项目工作区,然后在您的 cpp 文件中包含头文件的名称,如下所示
#include "Math.h";
我认为所有函数都清晰明了,并且在 C++ 和 C# 中具有相同的名称。
但我会讨论一下它们
--------------------------------------------------------------------------------
Cconvert 类包含所有基本数据类型转换,例如 (int、double、float、long、byte、bool、Cstring)
Cconvert x;int i=19; x.ToDouble(i); x.ToString (i,4); //4 mean the digits number that you want to apear to user //and so on...
--------------------------------------------------------------------------------
CIntStack 类接收整数并将它们放入动态增加的堆栈中
CIntStack s; s.Push(6); s.Push(7); s.GetCount() ; //get the number of stack Elements. Int buff=s.Pop();//buff =7; buff= s.Pop();//buff=6; buff=s.Pop();//buff=-1;
您还会找到 CstringStack 和 CdoubleStack,它们具有相同的函数
--------------------------------------------------------------------------------
CMath 类包含所有我们需要的数学函数,以及一些其他函数。
CMath m; m.Round(9.6); m.Ceil(8.6); m.Sin(2.7);//takes radians m.SinD(90);//takes Degree; m.Mean(arr,size);//get the mean of array; m.Median (arr,size);//get the Median of array; m.Sort(arr,10);//Sort integer and double arrays and take the size of array m.LinearSearch(arr,key,size);//key to be search with it and take double too; m.BinarySearch(arr,key,size);//this function call sort function frist to sort the array ,and //take double m.GetMaxInArray(arr,size);//get the max number in array int or double , m.GetMaxIndexInArray(arr,size);//get the index that have the max number. m.GetMax(var1,var2,var3);//get the max between three numbers and also two number. ///and you will find also GetMin functions like GetMax;and all regular math function //that you will need.
希望您喜欢它,如果遇到任何问题请告诉我。