这个代码有问题http://www.spoj.com/problems/BASE/它在Windows和Linux上运行正常但是当我在ideone上运行它时它没有显示任何输出.谁能告诉我这背后的原因是什么?
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<string>
#include<iostream>
using namespace std;
long int convert_base10(char *num, int base)
{
int len, dig;
long int result = 0;
len = strlen(num);
// printf("len = %d\n", len);
// converting to base 10
for(int i=0; i<len; i++)
{
if((num[len-i-1] >= 'A') && (num[len-i-1] <= 'F'))
dig = num[len-i-1] - 55;
else
dig = num[len-i-1] - 48;
result += (dig * pow(base, i));
// printf("num[%d] = %d\n", len-i-1, dig);
}
return result;
}
void convert_basei(long …Run Code Online (Sandbox Code Playgroud) 您好,我是 React 和 Nodejs 的新手。目前我正在尝试在 react 中创建一个登录组件,其中包含一个按钮,应用程序可以通过该按钮通过 Facebook 对用户进行身份验证。我正在使用passport.js 进行身份验证。我还使用回流来处理对节点服务器的任何 api 调用。
以下是每个的相应代码
动作.js
var Reflux = require('reflux');
module.exports = Reflux.createActions([
"facebookLogin"
]);
Run Code Online (Sandbox Code Playgroud)
商店.js
var Reflux = require('reflux');
var Actions = require('../actions');
var Api = require('../utils/api');
module.exports = Reflux.createStore({
listenables: [Actions],
facebookLogin: function(email) {
Api.FBrequest(email)
.then(function(response){
console.log('returned user for facebook from server : ' + response);
}.bind(this));
}
});
Run Code Online (Sandbox Code Playgroud)
api.js
module.exports = {
FBrequest: function() {
return (
fetch('/auth/facebook', {
method: 'get'
}).then(function(response){
return response.json();
})
);
}
};
Run Code Online (Sandbox Code Playgroud)
脸书.js …
我在C++中创建了一个程序,其中我使用了两个char数组,我在声明时初始化,当我使用strlen()函数计算它们的长度时,我得到了奇怪的输出.代码如下所示
#include<stdio.h>
#include<string.h>
#include<string>
using namespace std;
char consonant[] = {'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'};
char vowel[] = {'a', 'e', 'i', 'o', 'u'};
int main()
{
int lenv, lenc;
lenc = strlen(consonant);
lenv = strlen(vowel);
printf("lenv = %d and lenc = %d\n", lenv, lenc);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在ideone上运行时上面程序的输出是
lenv = 26 and lenc = 21
Run Code Online (Sandbox Code Playgroud)
当使用codeblocks在Windows上运行时
lenv = 5 and lenc = …Run Code Online (Sandbox Code Playgroud)