Pa help naman need ko idea
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
struct person {
std::string fname;
std::string lname;
int age;
char status;
};
#include <sstream>
using namespace std;
struct Resident {
string Name;
int Age;
char Condition;
};
#include <iostream>
#include <sstream>
#include "Resident.h";
using namespace std;
int main()
{
string barangayName;
int estimatedNumberOfResidents=0;
int c = 0;
int actualEnteredNumber = 0;
bool isFinished = false;
char moreEntry;
cout << "Earthquake Incident \n";
cout << "Name of Barangay: ";
cin >> barangayName;
cout << "Estimated number of residents: ";
cin >> estimatedNumberOfResidents;
cout << endl << endl;
Resident * residentList = new Resident[estimatedNumberOfResidents];
do
{
Resident* resident = new Resident;
cout << "Name: ";
cin >> resident->Name;
cout << "Age: ";
cin >> resident->Age;
cout << "Condition (A,D,I or M): ";
cin >> resident->Condition;
residentList[actualEnteredNumber] = *resident;
cout << "More Entry (Y/N)? ";
cin >> moreEntry;
actualEnteredNumber++;
if(moreEntry == 'N' || actualEnteredNumber >= estimatedNumberOfResidents)
isFinished = true;
cout << endl;
} while (!isFinished);
cout << "List of Victims/Casualties" << endl;
cout << "Name \t" << "Age \t" << "Condition" << endl;
for (c = 0; c < actualEnteredNumber; c++)
{
cout << residentList[c].Name <<"\t"<< residentList[c].Age << "\t" << residentList[c].Condition<<endl;
}
delete[] residentList;
}