学习solidity语言
pragma solidity ^0.4.10;
contract success{
address owner;
/* function Counter() view {
owner==msg.sender;
} */
struct target{
string name;
string age;
// int preindex;
}
/*struct tar{
address[] addr;
mapping(address=>target) preindex;
}*/
uint [] arr;
uint id;
mapping(uint => target) public map;
// mapping(uint=>uint) public indexMap;
target[] targets;
mapping(address=>target[]) public resMap;
// uint a=2;
uint index;
function tarInsert(uint a,string b,string c,address addr) public returns(uint) {
id=a;
map[id]=target({
name:b,
age:c
// preindex:(targets.length-2)
});
index = targets.push(map[id]);
resMap[addr]=targets;
return index;
}
function getTarget() public view returns(uint){
return id;
}
//销毁合约
function kill() public {
if (owner == msg.sender) {
selfdestruct(owner);
}
}
}