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. css rgba/hsla知识点讲解及半透明边框

    一.RGBA(R,G,B,A) 参数: R:红色值.正整数 | |百分数 G:绿色值.正整数 | |百分数 B:蓝色值.正整数 | |百分数 A:Alpha透明度.取值0~1之间. 说明:此色彩模式与 ...

  2. android学习之VelocityTracker

    今天大概的学习了一下 VelocityTracker ,用来监控手势速度的,在View移动过程中,可以有个缓冲的移动.  我觉得初步的使用起来是很简单的. 首先移动依靠的是Scroller类,Scro ...

  3. matlab 中“newff” 函数的参数设置

    matlab 中"newff" 函数的使用方法技巧|和各参数的意义 先来一个简单的源程序让大家练习一下: % Here input P and targets T define a ...

  4. python 后台服务

    centos 6x #!/bin/sh # chkconfig: 123456 90 10 # TTS Server for Speech Synthesis # workdir=/etc/speec ...

  5. 一.配置简单的嵌入式tomcat和jetty

    我们写了一个web应用,打成war包后,就需要找一个server来部署.对于我们的实际应用,我们基本没必要自己再写一个嵌入式的server.接下来两篇文章只是以钻研的心态来学习一下嵌入式tomcat和 ...

  6. win10安装mxnet cuda9.0-gpu版

    类似于上一篇文章 Anaconda3.6    python3.6.5   cuda9.0+   cudnn7.0 安装MXNet 1.设置清华源 conda config --prepend cha ...

  7. matlab解方程

    [x1,y1,x2,y2]=solve('x1^2 + y1^2=1','x2^2-8*x2 +y2^2 +15=0','x1*x2 + y1 * y2=1','x1 + x2 =a','x1','y ...

  8. 安装PYTHON PIL包

    安装pillow而不是PIL pip install pillow 参考: https://github.com/python-pillow/Pillow

  9. Ubuntu 下安装Mongodb

    Mongodb是一款开源的数据库,这里不用我多说了,下面说一下Ubuntu下安装Mongodb可能遇到的问题和解决方案. 故事背景: 今天M$促销,1¥Windows Azure 4000¥-30天的 ...

  10. Android(java)学习笔记39:Android 修改字体

    首先如果android内部自带的字体不是我们需要的字体,那我们就需要字体文件导入到android开发工程中,下午我们详细讲述: 1.我们首先分析知道,我想要TextView控件中文字的字体是:华文楷体 ...