What type of error or omission am I committing in the code?
Specifically in the statement% main% co_. Error which I have solved comparing the results one by one, which would be problematic when you have to compare more than 3 variables.
#include<iostream>
using namespace std;
struct persona{
string nombre, pat, mat;
};
int main(){
persona a,b;
b.nombre = "luz";
b.pat = "dia";
b.mat = "noche";
cout<<"ingrese su nombre : ";
cin>>a.nombre;
cout<<"ingrese su apellido paterno : ";
cin>>a.pat;
cout<<"ingrese su apellido materno : ";
cin>>a.mat;
if(a == b)cout<<"son la misma persona.";//aqui tengo el problema. Siento de que se me olvida algo...
else cout<<"son diferentes personas.";
Here is how I resolved it.
if(a.nombre == b.nombre){
if(a.pat == b.pat){
if(a.mat == b.mat)cout<<"son la misma persona.";
}
else cout<<"son diferentes personas.";
}
else cout<<"son diferentes personas.";