forked from ISUCT/Informatics_2023
-
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
Showing
2 changed files
with
39 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,29 @@ | ||
package lab5 | ||
|
||
import "fmt" | ||
|
||
type cat struct { | ||
age uint64 | ||
breed string | ||
name string | ||
} | ||
|
||
func CreateStruct(age uint64, breed, name string) cat { | ||
return cat{age, breed, name} | ||
} | ||
|
||
func SetAge(new_age uint64, c *cat) uint64 { | ||
c.age = new_age | ||
return c.age | ||
} | ||
func SetBreed(new_breed string, c *cat) string { | ||
c.breed = new_breed | ||
return c.breed | ||
} | ||
func SetName(new_name string, c *cat) string { | ||
c.name = new_name | ||
return c.name | ||
} | ||
func PrintInfCat(c *cat) { | ||
fmt.Println("Cat's name is", c.name, "\nCat's breed is", c.breed, "\nCat's age is", c.age, "\n") | ||
} |
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