I've already tried to fix every error my program shows, but so far I can't get it to compile and run. Maybe it's because I'm a newbie to OOP. :(
Any suggestions to get my program working? This is my code:
opuntia.h
class Taxonomia {
public:
string nombre;
string familia;
string genero;
string categoria;
void introducir();
void imprimir();
friend void categoria(Taxonomia&, std::string);
};
opuntia.cpp
#include "opuntia.h"
#include <iostream>
using namespace std;
void Taxonomia::introducir() {
cout << "Ingresa el nombre de la planta: ";
cin >> nombre;
cout << "Ingresa la familia de la planta: ";
cin >> familia;
cout << "Ingresa el genero de la planta: ";
cin >> genero;
}
void Taxonomia::imprimir() {
cout << "Nombre: " << nombre << endl;
cout << "Familia: " << familia << endl;
cout << "Género: " << genero << endl;
}
void categoria(Taxonomia& t, string nueva_categoria) {
t.categoria = nueva_categoria;
cout << "Categoria de riesgo de " << t.nombre << " actualizada: " << t.categoria << endl;
}
main.cpp
#include "opuntia.h"
#include <iostream>
#include <string>
#include <locale.h>
using namespace std;
int main() {
setlocale(LC_ALL, "spanish");
Taxonomia planta;
planta.imprimir();
return 0;
}
This is the list of errors I get: