Tengo que crear un programa en c++ que me permita calcular los gastos diarios y semanales y usar una estructura para manejar los datos pero no se como sumar los datos de una estructura ya que me sale error. Los gastos diarios deberian ser calculados y mostrados accediendo a un menu llamado "ver gastos diarios" ademas generar reportes diarios y semanales.
#include<iostream>
#include<conio.h>
using namespace std;
//Aca la estructura
struct expenses{
char expensesName[20];
float expensesPrice;
float food;
float entertainment;
float clothes;
float transportation;
float utilities;
float housing;
}e[100];
int main(){
//Contador para mostrar dia que se gasta mas y menos
int n_days,mayor=0,menor=999999,posM,posm;
cout<<"For how many days would you like to calculate expenses: "; cin>>n_days;
for(int i=0;i<n_days;i++){
fflush(stdin); //Emptying buffer to allow us to enter more values.
cout<<"Please enter the day of the week : "; cin.getline(e[i].expensesName,20,'\n');
cout<<"How much did you spend in food: "; cin>>e[i].food;
cout<<"How much did you spend in entertainment: "; cin>>e[i].entertainment;
cout<<"How much did you spend in clothes: "; cin>>e[i].clothes;
cout<<"How much did you spend in transportation: "; cin>>e[i].transportation;
cout<<"How much did you spend in utilities: "; cin>>e[i].utilities;
cout<<"How much did you spend in housing: "; cin>>e[i].housing;
cout<<"Cost of expense: "; cin>>e[i].expensesPrice;
//MOST EXPENSIVE DAY
if(e[i].expensesPrice > mayor){
mayor = e[i].expensesPrice;
posM = i;
}
//CHEAPER DAY
if(e[i].expensesPrice < menor){
menor = e[i].expensesPrice;
posm = i;
}
cout<<"\n";
}
cout<<"\nYou spend mostly on: "<<endl;
cout<<"Day: "<<e[posM].expensesName<<endl;
cout<<"Amount: "<<e[posM].expensesPrice<<endl;
cout<<"\nYou spend less on: "<<endl;
cout<<"Day: "<<e[posm].expensesName<<endl;
cout<<"Amount: "<<e[posm].expensesPrice<<endl;
cout<<"\nYour spend on food: "<<endl;
cout<<"Day: "<<e[posM].food<<+<<utilities<<endl;
cout<<"Amount: "<<e[posM].food<<endl;