Please help guide me in the direction what I am doing wrong. I am in the process of the code but it reached an error please guide me where I need to change before I continue the rest of the code. That is why it will be incomplete
Please help guide me in the direction what I am doing wrong. I am in the process of the code but it reached an error please guide me where I need to change before I continue the rest of the code. That is why it will be incomplete
#include "stdafx.h"
#include <iostream>
#include <limits>
#include <cstdlib>
#include <array>
#include <ctime>
#include <string>
#include <
#include <cctype>
#include <iterator>
#include <algorithm>
#include <cmath>
#include<windows.h>
#include <conio.h>
using namespace std;
double donationamount[50];
string fullname[50];
int departmentdonation[50];
struct donorinfo
{
vector<string>donor_name[50];
vector<double>donor_amount[50];
vector<double>department_donation[50];
} dvariable;
void inputdonor(donorinfo *);
void displaydonor(donorinfo *);
void editdonor(donorinfo *);
void displayorganization(donorinfo *);
int main()
{
int index;
donorinfo Donors[50];
int choice;
const int
Add = 1,
Search = 2,
Display = 3,
Department = 4;
here:
do {
menu:
cout << "\n";
cout << " ************************************************************" << endl;
cout << " ** ==Menu== **" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ** 1. Add a contributor. **" << endl;
cout << " ** 2. Search and update contributor. **" << endl;
cout << " ** 3. Display all Donor information. **" << endl;
cout << " ** 4. Department Total. **" << endl;
cout << " ** 5. Exit. **" << endl;
cout << " ** **" << endl;
cout << " ** Choose one: **" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ************************************************************" << endl;
COORD c;
c.X = 34;
c.Y = 13;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), c);
cin >> choice;
switch (choice)
{
case Add:
{
inputdonor(Donors);
}
break;
case Search:
{
editdonor(Donors);
}
break;
case Display:
{
displaydonor(Donors);
}
break;
case Department:
{
displayorganization(Donors);
}
default:
{
cout << "Invalid choice. Please try again.";
}
}
}
while (choice != 5);
system("pause");
return 0;
}
void inputdonors(donorinfo *d)
{
int index = 0;
int NumberOfDonors;
cout << "\n|----------------------------------|" << endl;
cout << "|==== Record donor information ====|" << endl;
cout << "|----------------------------------|\n" << endl;
cout << "Please enter the number of donors you want to enter: ";
cin >> NumberOfDonors;
for (int i = 0; i < NumberOfDonors; i++)
{
cout << "\nPlease enter donor full name: \n";
getline(cin >> ws, fullname[i]);
dvariable.donor_name[i].push_back(fullname[i]);
cout << "\nPlease enter amount donor contributed: \n";
cin >> donationamount[i];
dvariable.donor_amount[i].push_back(donationamount[i]);
cout << "\n=Donation to organization= \n";
cout << "\n1.)NHTS 2.)PBL 3)PTK 4)SEA\n";
cout << "Pick the deparment number for donor:";
cin >> departmentdonation[i];
dvariable.department_donation[i].push_back(departmentdonation[i]);
}
}
Step by step
Solved in 2 steps