相关疑难解决方法(0)

强类型语言的关键方面是什么?

什么使语言强烈输入?我正在寻找强类型语言最重要的方面.

昨天我问PowerShell是否是强类型的,但是没有人能就"强类型"的定义达成一致,所以我想澄清这个定义.

随意链接到维基百科或其他来源,但不要只剪切和粘贴您的答案.

strong-typing

17
推荐指数
5
解决办法
1万
查看次数

未定义的方法` - '表示"100":字符串

这个Ruby代码:

income = "100"
bills  = "52"

puts income - bills
Run Code Online (Sandbox Code Playgroud)

扔错了:

./to_f.rb:6: undefined method `-' for "100":String (NoMethodError)
Run Code Online (Sandbox Code Playgroud)

在对它们执行数学运算时,Ruby不会将字符串自动转换为数字吗?

ruby string floating-point integer

6
推荐指数
2
解决办法
5800
查看次数

C中的主要因素

我遇到了这个有效的程序来打印给定数字的所有主要因素:

# include <stdio.h>
# include <math.h>

// A function to print all prime factors of a given number n
void primeFactors(int n)
{
    // Print the number of 2s that divide n
    while (n%2 == 0)
    {
        printf("%d ", 2);
        n = n/2;
    }

    // n must be odd at this point.  So we can skip 
    // one element (Note i = i +2)
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        // While i …
Run Code Online (Sandbox Code Playgroud)

c primes algebra sqrt

1
推荐指数
1
解决办法
125
查看次数

标签 统计

algebra ×1

c ×1

floating-point ×1

integer ×1

primes ×1

ruby ×1

sqrt ×1

string ×1

strong-typing ×1