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.
 
 
 
 

1.0 KiB

enigma

Instructions

Écrire une fonction nommé Enigma qui prends des pointeurs comme arguments et qui interchanges leurs valeurs pour les cacher. Cette fonction déplacera :

  • a dans c.
  • c dans d.
  • d dans b.
  • b dans a.

Fonction attendue

func Enigma(a ***int, b *int, c *******int, d ****int) {

}

Utilisation

Voici un éventuel programme pour tester votre fonction :

package main

import (
	"fmt"
	piscine ".."
)

func main() {
	x := 5
	y := &x
	z := &y
	a := &z

	w := 2
	b := &w

	u := 7
	e := &u
	f := &e
	g := &f
	h := &g
	i := &h
	j := &i
	c := &j

	k := 6
	l := &k
	m := &l
	n := &m
	d := &n

	fmt.Println(***a)
	fmt.Println(*b)
	fmt.Println(*******c)
	fmt.Println(****d)

	student.Enigma(a, b, c, d)

	fmt.Println("After using Enigma")
	fmt.Println(***a)
	fmt.Println(*b)
	fmt.Println(*******c)
	fmt.Println(****d)

}

Et son résultat :

student@ubuntu:~/[[ROOT]]/test$ go build
student@ubuntu:~/[[ROOT]]/test$ ./test
5
2
7
6
After using Enigma
2
6
5
7
student@ubuntu:~/[[ROOT]]/test$