using namespace std;
struct donor
{
string donor_name[50];
double donor_amount[50];
int department_donation[50];
};
string find_name;
double *NHTS;
double *PBL;
double *PTK;
double *SEA;
int search_display;
int contributor;
int display;
int choice;
int main()
{
here:
cout <>
cout < "="" ************************************************************"=""><>
cout < "="" **="=Menu==" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" **="" 1.="" add="" a="" contributor.="" **"=""><>
cout < "="" **="" 2.="" search="" and="" update="" contributor.="" **"=""><>
cout < "="" **="" 3.="" display="" all="" donor="" information.="" **"=""><>
cout < "="" **="" 4.="" department="" total.="" **"=""><>
cout < "="" **="" 5.="" delete="" donation.="" **"=""><>
cout < "="" **="" 6.="" exit.="" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" **="" choose="" one:="" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" **="" **"=""><>
cout < "="" ************************************************************"=""><>
COORD c;
c.X = 34;
c.Y = 13;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), c);
cin >> choice;
int NumberOfDonors;
donor *ptr, d;
ptr = &d;
switch (choice)
{
case 1:
COORD c;
c.X = 20;
c.Y = 20;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), c);
cout < "\n|----------------------------------|"=""><>
cout < "|="===" record="" donor="" information="===|""><>
cout < "|----------------------------------|\n"=""><>
cout < "please="" enter="" the="" number="" of="" donors="" you="" want="" to="" enter:="">
(cin >> NumberOfDonors).get();
{
for (int i = 0; i < numberofdonors;="">
{
cout < "\nplease="" enter="" the="" name="" of="" the="" donor:="">
getline(cin >> ws, d.donor_name[i]);
cout < "\nplease="" enter="" amount="" donor="" contributed:="">
cin >> ptr->donor_amount[i];
cout < "\n="Donation" to="" organization="">
cout < "\n1.)nhts="" 2)pbl="" 3)ptk="">
cout < "pick="" the="" deparment="" number="" for="">
(cin >> ptr->department_donation[i]).get();
cout < "\ndonor="" information:="" \n"=""><>
cout < "\ndonor="" name:="" "="">< d.donor_name[i]=""><>
cout < "donation="" amount:="" "=""><>donor_amount[i] <>
cout < "donated="" to="" "="">< ptr-="">department_donation[i] < "="" department"=""><>
}
system("pause");
system("CLS");
}
goto here;
case 2:
{
COORD F;
F.X = 20;
F.Y = 20;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), F);
cout < "\n|-------------------------------------|"=""><>
cout < "|="==" search="" and="" update="" contributor="==|""><>
cout < "|-------------------------------------|\n"=""><>
tryagain:
cout < "\nplease="" type="" in="" the="" name:="">
getline(cin >> ws, find_name);
for (int i = 0; ; i++)
{
if (find_name == (*ptr).donor_name[i])
{
cout < "enter="" new="" amount:="" "=""><>
cin >> (*ptr).donor_amount[i];
}
else
{
char try_again;
cout < "i="" am="" sorry,="" we="" couldn't="" find="" that="">
place:
cout < "\nwould="" you="" like="" to="" try="" again?="" (y/n):="">
cin >> try_again;
if (try_again == 'Y' || try_again == 'y')
{
goto tryagain;
}
if (try_again == 'N' || try_again == 'n')
{
system("CLS");
goto here;
}
else if (try_again != 'N' && try_again != 'n' && try_again != 'Y' && try_again != 'y')
cout < "invalid="" input="" please="" enter="" (y/n).="" "=""><>
goto place;
}
}
system("pause");
}
system("CLS");
goto here;
case 3:
{
COORD D;
D.X = 20;
D.Y = 20;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), D);
cout < "\n|-----------------------------|"=""><>
cout < "|="==" display="" all="" donations="==|""><>
cout < "|-----------------------------|\n"=""><>
cout < "|----------------------------|"=""><>
cout < "|="" name="" |="" amount="" |="" department="" |"=""><>
for (int i = 0; i
{
cout < "|----------------------------|"=""><>
cout < "|"="">< "="">< "="" "="">< "="" |"=""><>< d.donor_amount[i]="">< "="" "="" "|"=""><">">< d.department_donation[i]="">< "|="" "=""><>
}
cout < "|----------------------------|"=""><>
system("pause");
system("CLS");
goto here;
}
case 4:
{
COORD G;
G.X = 20;
G.Y = 20;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), G);
cout <>
cout < "|="=Total" contributions="=">
cout <>
cout < "|="" nhts="" |="" pbl="" |="" ptk="" |="" sea="">
cout < "|"="">< nhts="">< "|"="">< pbl="">< "|"="">< ptk="">< "|"="">< sea=""><>
cout <>
}
system("pause");
system("CLS");
goto here;
case 5:
{
COORD E;
E.X = 20;
E.Y = 20;
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), E);
cout < "\n|-------------------------------|"=""><>
cout < "|="==" delete="" a="" donor="" donation="==|""><>
cout < "|-------------------------------|/n"=""><>
system("pause");
}
system("CLS");
goto here;
case 6:
{
exit(0);
}
default:
{
cout < "invalid="" choice,="" please="" try="" again="" and="" choose="" a="" value="" between="">
}
system("CLS");
goto here;
}
system("pause");
system("CLS");
return 0;
}