Go Program Please I need to write a program that import and uses the following p
ID: 3744560 • Letter: G
Question
Go ProgramPlease I need to write a program that import and uses the following packages:
fmt,flag,strings,os,strconv,math,image,image/color,image/png,math/cmplx.
Thank you so much. Go Program
Please I need to write a program that import and uses the following packages:
fmt,flag,strings,os,strconv,math,image,image/color,image/png,math/cmplx.
Thank you so much.
Please I need to write a program that import and uses the following packages:
fmt,flag,strings,os,strconv,math,image,image/color,image/png,math/cmplx.
Thank you so much.
Explanation / Answer
package main
import (
"fmt"
"flag"
"strings"
"os"
"strconv"
"math"
"image"
"image/color"
"image/png"
"math/cmplx"
)
var myImage = image.NewRGBA(image.Rect(0, 0, 200, 200))
var customColor color.Color
func main() {
// use of fmt package
fmt.Println("Use Of fmt package")
// use of flag package
wordPointer := flag.String("WORD", "anyword", "a string")
numberPointer := flag.Int("NUMBER", 189, "an int")
flag.Parse()
fmt.Println("WORD:", *wordPointer)
fmt.Println("NUMBER:", *numberPointer)
// use of strings package
fmt.println(strings.ToUpper("chegg"))
// use of os package
os.Mkdir("chegg",0777)
// use of strconv package
s := strconv.Atoi("-42")
fmt.printf("%d" , s)
// use of math package
fmt.Printf("%f", math.Acos(0))
// use of image , image/colour , image /png
customColor = color.RGBA{255, 0, 0, 255}
HLine(20, 30, 90)
customColor = color.RGBA{0, 255, 0, 255}
Rect(20, 20, 90, 60)
fp := os.Create("myImage.png")
defer fp.Close()
png.Encode(fp, myImage)
// use of math/cmplx
fmt.Printf("%.2f", cmplx.Exp(2i*math.Pi)+3)
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.