fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.08s 52592KB
stdin
#include <iostream>
#include <string>

using namespace std;

string calcularSueldo(string nombre, int cantidadPrendas) {
    int sueldoBase = 800;
    int pagoPorPrenda;

    if (cantidadPrendas >= 3 && cantidadPrendas <= 8) {
        pagoPorPrenda = 25;
    } else if (cantidadPrendas >= 9 && cantidadPrendas <= 12) {
        pagoPorPrenda = 45;
    } else if (cantidadPrendas >= 13 && cantidadPrendas <= 18) {
        pagoPorPrenda = 75;
    } else {
        pagoPorPrenda = 0;
    }

    int sueldoTotal = sueldoBase + (cantidadPrendas * pagoPorPrenda);
    return "Vendedor: " + nombre + "\nSueldo total del día: $" + to_string(sueldoTotal);
}

int main() {
    string nombre;
    int cantidad;

    cout << "Ingrese el nombre del vendedor: ";
    getline(cin, nombre);
    cout << "Ingrese la cantidad de prendas vendidas: ";
    cin >> cantidad;

    string resultado = calcularSueldo(nombre, cantidad);
    cout << resultado << endl;

    return 0;
}
stdout
Standard output is empty