Answer the question
In order to leave comments, you need to log in
What errors can there be in this go code that it doesn't run?
The code does not compile, i.e. exe file is missing. When you try to run it in the online editor on the go site, the first line is displayed, but then it says program exited. With what it can be connected?
package main
import (
"fmt"
)
func main(){
//declarating variables
var objecttype int
var mass int
var length int
var width int
var hight int
var density int
var subjecttype int
var liquidtype int
//var viscosity int
//var thermalconductivity int
var amount int
//
fmt.Printf("Hello, please, carefully read instructions.")
fmt.Printf("Now please choose a type of the object, material subject (like a cube), or electric (like a transistor). Just enter 1 or 2.")
fmt.Scan(&objecttype)
//For object
if objecttype == 1{ //object
fmt.Printf("Please enter subject length")
fmt.Scan(&length)
fmt.Printf("Please enter subject width")
fmt.Scan(&width)
fmt.Printf("Please enter subject hight")
fmt.Scan(&hight)
fmt.Printf("Please, enter the mass of the subject")
fmt.Scan(&mass)
fmt.Printf("Please, enter the density of the subject")
fmt.Scan(&density)
fmt.Printf("Please, choose subject type: liquid, metal, non-metal, just type 1, 2 or 3")
fmt.Scan(&subjecttype)
//for liquid
if subjecttype == 1{
fmt.Printf("Please, select one of existing liquids:")
fmt.Printf("1 - Mercury")
fmt.Printf("2 - Glycerol")
fmt.Printf("3 - Milk")
fmt.Printf("4 - Sea water")
fmt.Printf("5 - Water")
fmt.Printf("6 - Sunflower oil")
fmt.Printf("7 - Oil")
fmt.Printf("8 - Alcohol / Ethanol, kerosene")
fmt.Printf("9 - Petrol")
fmt.Printf("If your liquid not declared here, type 0")
fmt.Scan(&liquidtype)
if liquidtype == 1{
density = 13600
//viscosity = 1 //0.001526
//thermalconductivity = 1 //8.3
fmt.Printf("Please, enter the mass of the mercury")
fmt.Scan(&mass)
fmt.Printf("Please, enter the amount of mercury")
fmt.Scan(&amount)
}
}
}
}
Answer the question
In order to leave comments, you need to log in
How are you trying to compile it?
Just compiled under Ubuntu - everything is ok.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question