我制作了一个简单的递归程序,并使用默认参数计算程序中出现7次的次数,但是程序显示错误。
const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());
const { interface,bytecode} = require('../compile');
let accounts;
let inbox;
beforeEach( async() => {
accounts = await web3.eth.getAccounts();
inbox = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data: bytecode,arguments:['Hi There !'] })
.send({from: accounts[0], gas:'1000000'});
});
describe("inbox", () => {
it('deploys a contract', () => {
console.log(inbox);
})
})
预期输出为2,但收到错误消息
#include <stdio.h>
int count7(int n,int c = 0)
{
if(n==0)
return c;
if(n%10==7)
c++;
return count7(n/10,c);
}
int main()
{
printf("Hello World");
printf("%d",count7(727));
return 0;
}