-
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
19d3928
commit d9fe072
Showing
1 changed file
with
46 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,46 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
contract Day6 { | ||
struct Student { | ||
string name; | ||
uint256[3] marks; | ||
} | ||
Student student; | ||
|
||
function set( | ||
//Create a function set(name of student, marks in maths,marks in science,marks in english) - To set the name and marks of a student in marks array. | ||
string memory _name, | ||
uint256 maths, | ||
uint256 science, | ||
uint256 english | ||
) public { | ||
uint256 i = 0; | ||
student.name = _name; | ||
student.marks[i] = maths; | ||
i++; | ||
student.marks[i] = science; | ||
i++; | ||
student.marks[i] = english; | ||
} | ||
|
||
function get() | ||
//Create two functions get() - To get the name,marks in maths,marks in science and marks in english of the student. | ||
public | ||
view | ||
returns ( | ||
string memory, | ||
uint256, | ||
uint256, | ||
uint256 | ||
) | ||
{ | ||
return ( | ||
student.name, | ||
student.marks[0], | ||
student.marks[1], | ||
student.marks[2] | ||
); | ||
} | ||
} |