how to place a C++ relational operator?

Asked

Viewed 24 times

0

The exercise is to Read the value of a purchase in the Stores Your Best Purchase and show the value of the installments according to the amount of installments desired by the user. The store is selling your products in sight or installments up to 10 times without interest.

I’m managing to limit the amount of parcels by 10x

for the time being the code...

    #include <iostream>


using namespace std;

int main() {

float valordacompra;
int quantidadedeparcelas;

cin >> valordacompra >> quantidadedeparcelas;



cout << ("Valor da Compra:") << valordacompra << endl;
cout << ("Quantidade de parcelas:") << quantidadedeparcelas << endl;

float valordecadaparcela;
valordecadaparcela= valordacompra/quantidadedeparcelas;
cout << ("Valor de cada parcela:") << valordecadaparcela << endl;
  • It may be something like (after reading): while (quantidadedeparcelas < 0 || quantidadedeparcelas > 10) { cout << "Quantidade de parcelas inválida. Reinforme" << endl; cin << quantidadedeparcelas;}

  • I only need a 0 Return at the end, but thanks helped mt

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.