You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
## Fix the Main
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Fix the following program.
|
|
|
|
|
|
|
|
### Program to fix
|
|
|
|
|
|
|
|
```go
|
|
|
|
package piscine
|
|
|
|
|
|
|
|
func PrintStr(str string) {
|
|
|
|
arrayRune := []rune(str)
|
|
|
|
for _, s := range arrayRune {
|
|
|
|
z01.PrintRune(s)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func CloseDoor(ptrDoor *Door) bool {
|
|
|
|
PrintStr("Door Closing...")
|
|
|
|
state = CLOSE
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func IsDoorOpen(Door Door) {
|
|
|
|
PrintStr("is the Door opened ?")
|
|
|
|
return Door.state = OPEN
|
|
|
|
}
|
|
|
|
|
|
|
|
func IsDoorClose(ptrDoor *Door) bool {
|
|
|
|
PrintStr("is the Door closed ?")
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
door := &Door{}
|
|
|
|
|
|
|
|
OpenDoor(door)
|
|
|
|
if IsDoorClose(door) {
|
|
|
|
OpenDoor(door)
|
|
|
|
}
|
|
|
|
if IsDoorOpen(door) {
|
|
|
|
CloseDoor(door)
|
|
|
|
}
|
|
|
|
if door.state == OPEN {
|
|
|
|
CloseDoor(door)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|