首页 \ 问答 \ Pascal中的BigInteger(BigInteger in Pascal)

Pascal中的BigInteger(BigInteger in Pascal)

Free Pascal中是否存在BigInteger类型? 在Java和C#中存在BigInteger和BigDecimal类型。 我如何在Pascal中编写我用Java编写的相同代码:

package bigint;
import java.math.BigInteger;
/** 
 * @author Istvan
 */
public class bigint {

    public static void main(String[] args) {
        BigInteger a = new BigInteger("12345678913546876542545054683656469434");
        BigInteger b = new BigInteger("983435472457463464685743648468650354684046846841");

        BigInteger c = a.multiply(b);
        System.out.println("c="+c);
    }
}

Is there BigInteger type exists in Free Pascal? In Java and C# exists the type BigInteger and BigDecimal. How can I write the same code I have written in Java below in Pascal:

package bigint;
import java.math.BigInteger;
/** 
 * @author Istvan
 */
public class bigint {

    public static void main(String[] args) {
        BigInteger a = new BigInteger("12345678913546876542545054683656469434");
        BigInteger b = new BigInteger("983435472457463464685743648468650354684046846841");

        BigInteger c = a.multiply(b);
        System.out.println("c="+c);
    }
}

原文:https://stackoverflow.com/questions/18048142
更新时间:2023-04-30 07:04

最满意答案

这被称为最棘手的解析问题

ClassA item(ClassB(name));

应该是:

ClassB b(name);
ClassA item(b);

要么:

ClassA item( (ClassB(name)) );

另外看看: 最令人头痛的解析:为什么不A a(()); 工作?


This is called most vexing parse problem.

ClassA item(ClassB(name));

should either be:

ClassB b(name);
ClassA item(b);

or:

ClassA item( (ClassB(name)) );

Also have a look at: Most vexing parse: why doesn't A a(()); work?

相关问答

更多
  • 如果A是一个类,可以通过A::$strName直接访问它。 class A { public static $strName = 'A is my name'; } echo A::$strName; // outputs "A is my name" 更新: 根据你在数组中的内容,不管它是我喜欢定义的类对象还是类文字都可能是一个因素。 我通过这两个术语来区分, $objClasses = array(new A(), new B()); // class objects $myClasses ...
  • 您需要通过创建引用它的局部变量来扩展其范围,如下所示: function a_class_a_function() { var self = this; AFunctionThatTakesACallback(function() { console.log(self.a_var); }); } 你需要这样做的原因是因为AFunctionThatTakesACallback函数中的this引用与当前对象不同,它可能会引用全局window对象。 (通常不是你想要的)。 哦,我 ...
  • 你必须知道如何调用这些方法。 ex::show(); (...) obj->show(); 是(通常可能)由您的特定编译器翻译为: show(ex * this); (...) show(obj); 因为你不在里面使用this ,所以没有理由抛出异常...... 我强调了你的特定编译器 ,因为: C ++标准,第8.3.2章,参考文献 [注意:特别是,在一个定义良好的程序中不能存在空引用,因为创建这样一个引用的唯一方法是将它绑定到通过空指针间接获得的“对象”,这会导致未定义的行为 。 如9.6中所述 ...
  • 这被称为最棘手的解析问题 。 ClassA item(ClassB(name)); 应该是: ClassB b(name); ClassA item(b); 要么: ClassA item( (ClassB(name)) ); 另外看看: 最令人头痛的解析:为什么不A a(()); 工作? This is called most vexing parse problem. ClassA item(ClassB(name)); should either be: ClassB b(name); Cla ...
  • 你使用点: inst.staticmember ::仅用于命名空间或类,正如您可能从编译器错误中看到的一样。 您可以通过两种方式访问静态成员变量:通过classy::staticmember其中classy是一个类,或者inst.staticmember ,其中inst是一个类实例。 You use the dot: inst.staticmember :: is only for use with namespaces or classes, as you may have discerned fro ...
  • 类中static成员的声明,如static const int test = 5; 是一个声明但不是定义,即使它有一个初始化器。 声明通常应该有相应的定义。 这个定义看起来像const int A::test; (这不是“前瞻性声明”。) 但是,还有一个额外的规则,即如果只使用其值,不使用其地址,并且没有引用绑定到它(这与获取其地址类似),则不需要定义整数类型的static const类成员。 你正在调用的函数是void std::vector::push_back(const int&); 。 ...
  • forEach有一个可选的thisarg你可以在传递回调后传递,所以这应该工作: MyClass.prototype.foo = function(){ var arr = [1, 2, 3]; var myCurrentInstance = this; //Store temporary reference arr.forEach(function(element){ //Here it works because I use the temporary re ...
  • 你不能做$this->class::create() 。 如果你想访问一个静态成员,你必须使用Class::Member 。 Zend PHP解析器的当前实现仅支持直接在类名或变量上进行的静态方法调用。 这是语法: %token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)" function_call: name argument_list { $$ = zend_ast_create(ZEND_AST_CALL, $1, ...
  • 从C#5规范,第3.5.3节: 当在声明它的类的程序文本之外访问受保护的实例成员时,并且在声明它的程序的程序文本之外访问受保护的内部实例成员时,访问必须在类中进行声明派生自声明它的类。 此外,访问需要通过该派生类类型的实例或从其构造的类类型进行。 此限制可防止一个派生类访问其他派生类的受保护成员,即使这些成员是从同一基类继承的。 所以你可以访问任何NodeDerived对象的Parent属性: NodeDerived derivedNode = ...; Node parent = derivedNode. ...
  • 它正在发生,因为xhrObj函数onreadystatechage本质上是异步的,当它在完成调用后返回时, onreadystatechage()内部的上下文不同,因此this.xhrObj没有区别。 It is happening because xhrObj function onreadystatechage is asynchrous in nature and when it return after complete call this context is different inside t ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)