pragma solidity ^0.4.0;

contract EMath{

    string public _a="lin";

    function f() public{
modify(_a);
} //function modify(string storage name) private{
function modify(string memory name) private{
//string storage c = name;Type string memory is not implicitly convertible to expected type string storage pointer
var c = name;
bytes(c)[0] ='L';
} //uint8 ~ uint256
//0000 0000 ~ 1111 1111
//0 ~255
//int8 ~ int256
//1111 1111 ~ 0111 1111
//-127 + 127 +0 =255 uint8 a=3;
//0000 0011
uint8 b=6;
//0000 0110
function yihuo() view returns(uint){
return a ^ b;
/*
0000 0011
0000 0110
0000 0101
*/
} function yifeihuo() view public returns(uint16){
return ~(a ^ (~b));
/*
0000 0011 0000 0110
1111 1001 1111 1010
*/
} function huo() returns(uint){
return a | b;
/*
0000 0011
0000 0110 0000 0111
*/
} function yu() returns(uint){
return a & b;
/*
0000 0011
0000 0110 0000 0010
*/
}
function left() returns(uint8){
return a<<2;
/*
0000 0011 0000 1100
*/
} enum Cants{left,right,mid} Cants public def=Cants.left; function re(Cants c1) returns(bool){
if (def ==c1){
return true;
}
} struct fun{
uint _id;
string _name;
uint _sex;
} //0x14723a09acff6d2a60dcdf7aa4aff308fddc160c
//0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db fun n1=fun(0,'eilinge',1);
fun n2=fun(1,'lin',0); fun[] public funs;
fun[] public funids; function p1() public{
funs.push(n1);
funs.push(n2);
} uint funid;
mapping(address=> fun) addfun; function p2(address na1) public{
fun memory f1 =addfun[na1];
//f1(2,'eil',0);type is not callable
f1._id=2;
}
} contract Addr{
address _owner =0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
uint160 _c = 1154414090619811796818182302139415280051214250812;
/*
0x ca35b7d915458ef540ade6068dfe2f44e8fa733c :.legnth=40
c a
0b 1100 1010 :.length=40*4=uint160
*/
function f1() constant returns(uint160){
return uint160(_owner);
} function f2() constant returns(address){
return address(_c);
} function getBalance(address add) payable returns(bool){
//return add.balance;
add.transfer(msg.value);//msg.sender => add
} bytes1 _a=0xf0;
//0010 0010; 1*8
bytes32 public _b=0x231231;
//32*8 function getLeng() returns(bytes1){
//return _b.length;
return _a[0];
}
function getLeng1() {
//_b.length =5;Expression has to be an lvalue
} string public _d='lilianjie';
//bytes public _f =new bytes;type function (uint256) pure returns (bytes memory)
//is not implicitly convertible to expected type bytes storage ref
bytes public _f =new bytes(2); function bytestring() constant returns(bytes){
return bytes(_d);
}
function stringbytes() constant returns(string){
return string(_f);
}
function modifybytes() public{
//_d.length=5;
//Member "length" not found or not visible after argument-dependent lookup in string storage ref
bytes(_d).length=5;
_f.length=3;
//_d[0]='E';Member "length" not found or not visible after argument-dependent lookup in string storage ref bytes(_d)[0]="L";
}
}

ethereum(以太坊)(基础)--容易忽略的坑(二)的更多相关文章

  1. ethereum(以太坊)(基础)--容易忽略的坑(三)

    pragma solidity ^0.4.10; contract Byte{ bytes [] public T=new bytes[](3); function setLeng(uint len) ...

  2. ethereum(以太坊)(基础)--容易忽略的坑(一)

    pragma solidity ^0.4.0; contract base{ address public _owner=msg.sender; uint _a; string internal _b ...

  3. C#以太坊基础入门

    在这一部分,我们将使用C#开发一个最简单的.Net控制台应用,来接入以太坊节点,并打印 所连接节点旳版本信息.通过这一部分的学习,你将掌握以下技能: 如何使用节点仿真器 如何在命令行访问以太坊节点 如 ...

  4. ethereum(以太坊)(一)

    从这周开始,开始学习以太坊开发--solidity,开始决定往区块链方向发展,毕竟区块链技术应用广泛.一开始接触solidity开发语言不太习惯,毕竟一直在学习python语法,有很多都不能接受.有难 ...

  5. c#实战开发:以太坊钱包对接私链 (二)

    上一篇讲了 以太坊私链搭建 首先下载Ethereum Wallet 钱包 可以直接百度 下载如果直接打开它会默认连接公链 所以我们要通过命令打开 "F:\Program Files\Ethe ...

  6. 以太坊 layer2: optimism 源码学习(二) 提现原理

    作者:林冠宏 / 指尖下的幽灵.转载者,请: 务必标明出处. 掘金:https://juejin.im/user/1785262612681997 博客:http://www.cnblogs.com/ ...

  7. ethereum(以太坊)(十二)--应用(二)__投票(基础总和)

    编写应用合约之前,先弄清它的逻辑,有助于我们更好的部署合约 pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; contract vo ...

  8. ethereum(以太坊)(实例)--"安全的远程购买"

    pragma solidity ^0.4.10; contract Safebuy{ uint public price; address public seller; address public ...

  9. ethereum(以太坊)(实例)--"简单的公开竞拍"

    说真的,刚开始接触这个竞拍案例--“简单的公开竞拍”,我就抱着简单的心态去查看这个实例,但是自我感觉并不简单.应该是我实力不到家的原因吧!!!233333...不过经过大半天的努力,自己理解完之后,觉 ...

随机推荐

  1. mui使用技巧

    1.document.addEventListener('plusready', function(){ //console.log("所有plus api都应该在此事件发生后调用,否则会出 ...

  2. 任务二:零基础HTML及CSS编码练习

    任务目的 针对设计稿样式进行合理的HTML架构,包括以下但不限于: 掌握常用HTML标签的含义.用法 能够基于设计稿来合理规划HTML文档结构 理解语义化,合理地使用HTML标签来构建页面 掌握基本的 ...

  3. tensorflow读取jpg格式图片报错 ValueError: Only know how to handle extensions: ['png']; with Pillow installed matplotlib can handle more images

    当运行mpimg.imread("img.jpg")时,spyder 出现如下错误: ValueError: Only know how to handle extensions: ...

  4. python学习笔记(1)----python安装

    1.下载Python for windows 废话不说,直接上网址:https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe 2.安装Pytho ...

  5. js alert 封装 layui

    方式一: var aaa = function(){ function _alert(aa){ layer.msg(aa, { time: 2000, //2s后自动关闭 alert("最高 ...

  6. June 15th 2017 Week 24th Thursday

    Whatever is worth doing is worth doing well. 任何值得做的,就把它做好. Whatever is worth doing is worth doing we ...

  7. 读REDIS数据结构

    一.DICT 主要有两个问题: 1.散列冲突,解决办法是拉链法 typedef struct dictEntry { void *key; union { void *val; uint64_t u6 ...

  8. Ubuntu adb device

    在ubuntu上经常出现系统无法识别android手机的情况,要解决这个问题可以用以下方法: 1. 执行 "android update adb", 这会创建"~/.an ...

  9. libevent-signal(2)

    上一节着重分析了event_init是如何集成signal,这一节从event_add展开分析 ev_events有四种类型 I/O事件: EV_WRITE和EV_READ 定时事件:EV_TIMEO ...

  10. PHP语言开发微信公众平台(订阅号)之注册(1)

    1.百度搜索"微信公众平台" 2.选择微信公众平台官网并单击打开 3.进入官网页面,单击 "立即注册" 进入注册页面 4.进入注册页面,单击订阅号 5.进入订阅 ...