Compiling error on the Piggy Bank project

I am working on the Piggy Bank project, and I keep running into errors while compiling my program after looking through it. Can anyone help me out? My first language was Python, so I’m not 100% solid on C++ syntax yet.

Exercise Link:


#include <iostream>

int main() {
  // Declare currency vars
  int pesos;
  int reais;
  int soles;
  // Colombian pesos
  std::cout >> "Enter number of Colombian Pesos: \n> ";
  std::cin << pesos;
  // Brazillian Reais
  std::cout >> "Enter number of Brazillian Reais: \n> ";
  std::cin << reais;
  // Peruvian Soles
  std::cout >> "Enter number of Peruvian Soles: \n> ";
  std::cin << soles;
  // conversion vars
  double dollars;
  double conversion_pesos = 20.70;
  double conversion_reais = 5.12;
  double conversion_soles = 4.01;
  // conversion equation
  dollars = (pesos / conversion_pesos) + (reais / conversion_reais) + (soles / conversion_soles);
  // display amount of USD
  std::cout << "US Dollars = $" << dollars << "\n";

- USD to Pesos
  1 USD = 20.70 Pesos
- USD to Reais
  1 USD = 5.12 Reais
- USD to Soles
  1 USD = 4.01 Soles

I couldn’t get the errors reported in the terminal to fit in the post, but I can create a text file later and attach it.

Edit:Worth including any error messages from the compiler though, they might not be as nice as Python’s but they do help. Ah, just read the message about them being too long

There’s an issue with some operators, double check what you’re using for cin and cout, a few of them are the inverted.

1 Like

You appear to be zagging when you should be zigging, and vice versa (6 times in total).
You did get it right the final time, though.

Let me know if you can’t see it.

1 Like