Dev dairy program c ++

0

I am doing a practice in which a milk salesman should know the profit he had from selling his liters of milk, but he is paid per gallon.

The program is being developed by DEV C ++

#include <iostream>

using namespace std;

int main ()
{
    float Litros, gal, ganancia, precio;
    cout << "Ingresa cantidad de litros de leche vendidos:" << endl;
    cin >> Litros;
    cout ,, "Precios por galon:" <<endl;
    cin >> precio;
    gal+ (Litros/3.785);
    ganancia= (precios*gal);
    cout << "Ganancia por venta del dia es de= " <<ganancia<<endl;
    return 0;
}

I get an error in the cout of line 8, exactly between the 2 commas. Also in the <

C:\Users\*****\programa_lechero.cpp:10:33: error: invalid operands of types 'const char [19]' and '<unresolved overloaded function type>' to binary 'operator<<'
  cout ,, "Precios por galon:" <<endl;
                                 ^
C:\Users\******\programa_lechero.cpp:13:13: error: 'precios' was not declared in this scope
  ganancia= (precios*gal);
    
asked by Acidous 09.08.2018 в 06:22
source

1 answer

1

There are several errors.

  • The two commas do not go, instead they go << .

  • gal = (Litros/3.785); instead of gal + (Liters / 3,785);

  • gain = ( prices * gal); must have precio in singular.

  • The code would be like this.

    #include <iostream>
    using namespace std;
    
    int main ()
    {
        float Litros, gal, ganancia, precio;
        cout << "Ingresa cantidad de litros de leche vendidos:" << endl;
        cin >> Litros;
        cout << "Precios por galon:" <<endl;
        cin >> precio;
        gal = (Litros/3.785);
        ganancia = (precio*gal);
        cout << "Ganancia por venta del dia es de= " <<ganancia<<endl;
        return 0;
    }
    
        
    answered by 09.08.2018 в 07:18