Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 4, 2020 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/14b8f170d30a7971df7fc45001919e07 to your computer and use it in GitHub Desktop.
Save parzibyte/14b8f170d30a7971df7fc45001919e07 to your computer and use it in GitHub Desktop.
/*
____ _____ _ _ _
| _ \ | __ \ (_) | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___|
__/ | __/ |
|___/ |___/
Blog: https://parzibyte.me/blog
Ayuda: https://parzibyte.me/blog/contrataciones-ayuda/
Contacto: https://parzibyte.me/blog/contacto/
Copyright (c) 2020 Luis Cabrera Benito
Licenciado bajo la licencia MIT
El texto de arriba debe ser incluido en cualquier redistribución
*/
#include <iostream>
using namespace std;
int main() {
int horas;
float sueldo;
std::cout << "Ingrese horas trabajadas: ";
cin >> horas;
if (horas <= 40) {
sueldo = 45 * horas;
} else {
// El sueldo que gana de las primeras 40 horas
sueldo = 45 * 40;
// Y el restante
int horasExtra = horas - 40;
float sueldoExtra = horasExtra * 22;
sueldo += sueldoExtra;
}
cout << "Sueldo: " << sueldo << "\n";
if (sueldo <= 1800) {
float sueldoSinAhorro = sueldo * 0.9;
cout << "Sueldo final (menos ahorro): " << sueldoSinAhorro;
} else {
float sueldoConRetencion = sueldo * 0.85;
cout << "Sueldo con retencion: " << sueldoConRetencion;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment