嘿! 我在http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html查看此代码
我注意到在某些情况下他们使用十六进制数字,如第134行:
for (j = 1; val && j <= 0x80; j <<= 1, q++)
Run Code Online (Sandbox Code Playgroud)
现在为什么他们会使用0x80?我对十六进制并不是那么好,但我发现一个在线十六进制到十进制,它给了我128为0x80.
同样在第134行之前,在第114行他们有:
small_n = (n & 0xffff0000) == 0;
Run Code Online (Sandbox Code Playgroud)
对于十六进制数字,十六进制到十进制给了我4294901760.所以在这一行中他们正在做一点AND并将结果与0进行比较?
为什么不直接使用这个号码呢?任何人都可以请解释,并请举例说明其他情况.
此外,我已经看到大行代码,它只是十六进制数字,从来没有真正理解为什么:(
有没有办法设置ff,即打印背景图像?
我正在使用星星图像来分类一些技巧,我将其设置为背景图像并定位为设置一个开始,两个,三个等.当我尝试打印页面时,图像消失.
那么有什么方法可以让我们在打印页面时出现它们,或者至少有办法用*或者可见的东西替换图像?
我试图理解左侧面板中Kcachegrind中显示的值
我有包含 (我在手册中读到的内容包括),Self,称为函数
现在我正在分析这个cachegrind文件,我有
Incl. ---- Self ---- Called ---- Function
100.05 ---- 0.04 ---- (0) ---- {main}
83.38 ---- 0.07 ---- 250 --- item->close
78.85 ---- 78.85 ---- 10 067 ---- php::mysql_query
Run Code Online (Sandbox Code Playgroud)
并且列表继续..
但这是我的问题.
我认为项目 - >关闭是我的瓶颈,但我不明白的是它是如何包含83.38的包含,然后是0.07的Self和mysql_query命令在两者中都是相同的.
"自我"在这里意味着什么?
这些百分比如何相互关联?我不明白item-> close需要83%而mysql_query需要78%
谢谢
我将重新开始使用c ++并考虑变量的范围.如果我在函数内部有一个变量然后我返回该变量,那么当它返回时变量不会"死",因为它所在的范围已经结束了?
我用函数返回一个字符串尝试了这个,它确实有效.有谁能解释一下?或者至少指出一些可以向我解释的地方.
谢谢
我正在做2 ^ 1000而且我得到了这个:
1.07151e + 301
有没有办法在不使用e + 301的情况下将其转换为正确的数字,或者至少有人可以通过某种方式使用e + 301部分向我显示如何将其转换为实数?
我有一个类生成一些html(表单元素和表元素),但这个类返回一行中的所有html.
所以我试图使用整洁来美化代码(缩进代码,放置换行符等),我遇到的唯一问题是也生成我不想要的标签.
这是代码:
tidy_parse_string(
$table->getHtml(),
array(
'DocType' => 'omit',
'indent' => true,
'indent-spaces' => 4,
'wrap' => 0
)
);
Run Code Online (Sandbox Code Playgroud)
我发现删除额外的html标签的唯一方法是添加一个str_replace,如下所示:
str_replace(array('<html>','</html>','<body>','</body>','<head>','</head>','<title>','</title>'),'', code);
Run Code Online (Sandbox Code Playgroud)
哪个有用,但我真的在跳,有一种方法可以告诉整洁只是美化代码而不是插入额外的代码.
我试图在C++变量中放置一个大数字.号码是600851475143
我尝试了unsigned long long int但是错误地说它常量太大了.然后我尝试了一个名为BigInt的bigInt库 - > http://mattmccutchen.net/bigint/
问题是我无法编译代码,因为我收到很多关于lib的错误.
未定义的引用`BigInteger :: BigInteger(int)'< - 很多这些.
到目前为止,这是我的代码:
#include "string"
#include "iostream"
#include "bigint/NumberlikeArray.hh"
#include "bigint/BigUnsigned.hh"
#include "bigint/BigInteger.hh"
#include "bigint/BigIntegerAlgorithms.hh"
#include "bigint/BigUnsignedInABase.hh"
#include "bigint/BigIntegerUtils.hh"
using namespace std;
int main() {
//unsigned long int num = 13195;
//unsigned long long int num = 600851475143;
BigInteger num = 13195;
int divider = 2;
//num = 600851475143;
while (1) {
if ((num % divider) == 0) {
cout << divider << '\n';
num /= divider;
} …
Run Code Online (Sandbox Code Playgroud) 我在小型网络上有一台电脑,所以我的IP是192.168.2.100.
我想要获得真正的IP.我下载了no-ip客户端,但这对于这么简单的事情来说似乎很麻烦.
我创建了这个php脚本,它获得了http://www.ip-adress.com/ page并检索了它给我的ip.
有更简单的方法吗?使用C,WSH或其他东西.或者,如果有一个更简单的PHP方式请告诉我.
当我拿到ip时,我会将它上传到我的ftp网站,以便我可以看到ip从工作中.
我正在尝试创建一个小的ajax聊天系统(只是为了它),我正在使用prototype.js来处理ajax部分.
我在帮助中读到的一件事是,如果你返回json数据,回调函数将在第二个参数中填充json数据.
所以在我调用的php文件中我有:
header('Content-type: application/json');
if (($response = $acs_ajch_sql->postmsg($acs_ajch_msg,$acs_ajch_username,$acs_ajch_channel,$acs_ajch_ts_client)) === true)
echo json_encode(array('lastid' => $acs_ajch_sql->msgid));
else
echo json_encode(array('error' => $response));
Run Code Online (Sandbox Code Playgroud)
在ajax请求我有:
onSuccess: function (response,json) {
alert(response.responseText);
alert(json);
}
Run Code Online (Sandbox Code Playgroud)
response.responseText的警报给了我{"lastid":8}但是json给了我null.
谁知道我怎么能做这个工作?
我有这个代码
#include <iostream>
using namespace std;
int main(int argc,char **argv) {
unsigned long long num1 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995LL;
unsigned long long num2 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996LL;
unsigned long long num3 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997LL;
unsigned long long num4 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998LL;
unsigned long long num5 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999LL;
cout << (unsigned long long)(num1 * num2 * num3 * num4 * num5) << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
你可以看到数字是巨大的,但当我在那里做数学时我得到了这个:18446744073709551496
在编译时我得到这些警告:
warning: integer constant is too large for its type|
In function `int main(int, char**)':|
warning: this decimal constant is …
Run Code Online (Sandbox Code Playgroud) c++ ×5
php ×4
biginteger ×2
c ×2
html ×2
ajax ×1
css ×1
forms ×1
hex ×1
ip-address ×1
javascript ×1
kcachegrind ×1
limits ×1
math ×1
networking ×1
prototypejs ×1
return-value ×1
scope ×1
tidy ×1
wsh ×1