-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c4e89a
commit 74a8d0a
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
contract Day4 { | ||
//Task Create a structure -> struct Book { string title; string author; uint256 book_id; } | ||
struct Book { | ||
string title; | ||
string author; | ||
uint256 book_id; | ||
} | ||
Book book; | ||
|
||
function setBook( | ||
//Create two functions a) setBook(title(string),author(string),id(uint)) - To set the book title, author and id given in the structure. b) getBook() - To get the book title,author and id. | ||
string memory _titile, | ||
string memory _author, | ||
uint256 _id | ||
) public { | ||
book = Book(_titile, _author, _id); | ||
} | ||
|
||
function getBook() | ||
public | ||
view | ||
returns ( | ||
string memory, | ||
string memory, | ||
uint256 | ||
) | ||
{ | ||
return (book.title, book.author, book.book_id); | ||
} | ||
} |