online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/* PROGRAMA DE CÁLCULO DE SUELDO CON OVERTIME */ package main import "fmt" func main() { repetir := 'y' var sph, ht, sueldobruto, overtimePay float32 var regularHours float32 = 40.0 // Declare regularHours as float32 for repetir == 'y' { // Input valores usuario fmt.Print("Entre su sueldo por hora: ") fmt.Scan(&sph) // Validar no se aceptan valores negativos if sph > 0 { fmt.Print("Entre la cantidad de horas trabajadas: ") fmt.Scan(&ht) // Validar no se aceptan valores negativos if ht > 0 { if ht > regularHours { // Calcular sueldo incluyendo overtime overtimeHours := ht - regularHours sueldobruto = sph * regularHours overtimePay = sph * 1.5 * overtimeHours sueldobruto += overtimePay } else { // Calcular sueldo sin overtime sueldobruto = sph * ht } fmt.Printf("El sueldo total por la cantidad de horas trabajadas es $%.2f\n", sueldobruto) } else { fmt.Println("Debe ser un valor mayor de 0") } } else { fmt.Println("Debe ser un valor mayor de 0") } // Preguntar si desea calcular nuevamente fmt.Print("Desea calcular el sueldo de otro empleado? (y/n): ") var respuesta string fmt.Scan(&respuesta) if respuesta == "n" { repetir = 'n' } else if respuesta != "y" { fmt.Println("Por favor, escribir 'y' o 'n'.") repetir = 'n' } } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue