I need help finding the sum of the expense in this array. Please tell me whats wrong with this and help me fix it. Will appreciate it thank you
Code:
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;
int main()
{
char type[100];
double total=0;
double amount;
int numbers=0;
int i=0;
char name[30];
cout << "enter the employee name:"<< endl;
cin.getline(name,30);
cout << "enter the number of expense items:" << endl;
cin >> numbers;
cin.ignore();
while (i < numbers)
{
i++;
cout << "enter the type of expense:";
cin.getline(type,100);
cout << "enter the amount of expense:";
cin >> amount;
cin.ignore();
for (i=0; i <=numbers; i++)
{
total += amount[i];
i++;
cout << "total =" << total << endl;
}
}
}