Created
January 6, 2022 06:49
-
-
Save Sankalpks/a285f9cd9616d5a547624fb7e26c7c0c to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=builtin&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.0; | |
contract MyContract{ | |
mapping(uint=>Book) public books; | |
mapping(address=> mapping(uint=>Book)) public mybooks; | |
struct Book{ | |
string Title; | |
string Author; | |
} | |
function addbook(uint _id,string memory _Title, string memory _Author) public { | |
books[_id]= Book(_Title, _Author); | |
} | |
function addmybooksid(uint _id,string memory _Title, string memory _Author) public { | |
mybooks[msg.sender][_id]= Book(_Title, _Author); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment