The name won't show case three but the other functions do. What is the issue?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The name won't show case three but the other functions do. What is the issue?

#include "stdafx.h"

#include <iostream>
#include <limits>
#include <cstdlib>

#include <ctime>
#include <string>
#include <vector>
#include <cctype>
#include <iterator>
#include <algorithm>
#include <cmath>
#include<windows.h>
#include <conio.h>

 


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 << "\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. Delete Donation. **" << endl;
cout << " ** 6. 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;
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|----------------------------------|" << endl;
cout << "|==== Record donor information ====|" << endl;
cout << "|----------------------------------|\n" << endl;
cout << "Please enter the number of donors you want to enter: ";
(cin >> NumberOfDonors).get();
{

for (int i = 0; i < NumberOfDonors; i++)
{

cout << "\nPlease enter the name of the donor: \n";
getline(cin >> ws, d.donor_name[i]);

cout << "\nPlease enter amount donor contributed: \n";
cin >> ptr->donor_amount[i];
cout << "\n=Donation to organization= \n";
cout << "\n1.)NHTS 2)PBL 3)PTK 4)SEA\n";
cout << "Pick the deparment number for donation:";
(cin >> ptr->department_donation[i]).get();

cout << "\nDonor information: \n" << endl;

cout << "\nDonor name: " << d.donor_name[i] << endl;
cout << "Donation amount: " << "$"<<ptr->donor_amount[i] << endl;
cout << "Donated to " << ptr->department_donation[i] << " department" << endl;
}


system("pause");
system("CLS");

}

goto here;

case 2:
{
COORD F;
F.X = 20;
F.Y = 20;

SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), F);
cout << "\n|-------------------------------------|" << endl;
cout << "|=== Search and update contributor ===|" << endl;
cout << "|-------------------------------------|\n" << endl;
tryagain:
cout << "\nPlease type in the name: \n";
cin.sync();
cin.ignore();
getline(cin >> ws, find_name);
for (int i = 0; ; i++)
{
if (find_name == (*ptr).donor_name[i])
{
cout << "Enter New Amount: " << endl;
cin >> (*ptr).donor_amount[i];
}
else
{
char try_again;
cout << "I am sorry, we couldn't find that information.\n";
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). " << endl;
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|-----------------------------|" << endl;
cout << "|=== Display all donations ===|" << endl;
cout << "|-----------------------------|\n" << endl;

cout << "|----------------------------|" << endl;
cout << "| Name | Amount | Department |" << endl;
for (int i = 0; i<NumberOfDonors; i++)
{

cout << "|----------------------------|" << endl;
cout << "|" << " "<<d.donor_name[i] << " " << " |" <<"$"<< d.donor_amount[i] << " " "|" <<" "<< d.department_donation[i] << "| " << endl;

}
cout << "|----------------------------|" << endl;
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|-------------------------------|" << endl;
cout << "|=== Delete a donor donation ===|" << endl;
cout << "|-------------------------------|\n" << endl;
system("pause");

}
system("CLS");
goto here;
case 6:
{
exit(0);
}
default:
{
cout << "Invalid choice, Please try again and choose a value between 1-6";

}
system("CLS");
goto here;

}

system("pause");
system("CLS");
return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education