Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
#include <iostream>
#include <string>
#include<iomanip>
#include<fstream>
#include<conio.h>
#include <sstream>
#include<windows.h>
#include<time.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <conio.h>
#include <iomanip>


using namespace std;
fstream fp;
struct informationinfo{
	
	string fname;
	string mname;
	string lname;
	string sex;
	string occupation;
	string birthday;
	string address;
	long double salary;
	unsigned long long int cpnumber;
	int age;
	int memberid;
	int familymembers;
		
}person;

struct inventoryinfo{
	string itemn;
	string itemcode;
	int quantity;
	long double price;
}item;

struct donatetorinfo{
	
	string fullname;
	string address;
	unsigned long long int number;
	int amount_of_donation;
	
}donate;
struct plans{
	string event;
	string date;
	string address;
	string description;
}day;
//globals
//functions
void menulist();
void information();
void inventory();
void donation();
void planner();



//inside information functions
void add_();;
void display_();
void edit_();
void search_();
void displaymember();
//inside inventory function
void inventoryadd();
void displayinvent();
//Donation functions
void donateinfo();
void displaydonate();
//planner
void addplans();
void viewplans();

int main()
{
	/*
	string user;
	string pass;
	system("cls");
	system("title DAP");
	system("color 0f");
	
	int i;

        cout<<"\n\n\n\n\n\n\n\n\n\n\t\t\t\t LOADING...";
        cout<<"\n\n\n\t\t";
        cout<<" ";
        for (i = 0; i < 45; i += 1)
        {
        	int time = 100;
            Sleep(time);
            system("color 09");
            cout<<"¦";

        }
        
	do
	{
	system("cls");
	cout<<"\n\n\n\t\t\t\tUsername: ";
	cin>>user;
	cout<<"\t\t\t\tPassword: ";
	cin>>pass;
	}while(user != "admin" || pass != "1234");

if(user == "admin" && pass == "1234")
{
*/
	menulist();
//}

	getch();
	return 0;
}
void menulist()
{
	char choice;
	long int recsize;
	
	system("cls");
	system("title GOVERNMENT ASSISTANT PROGRAM");
	system("color 0f");
	
	cout<<"[1]Information"<<endl;
	cout<<"[2]Inventory"<<endl;
	cout<<"[3]Donation"<<endl;
	cout<<"[4]Planner"<<endl;
	cout<<"[5]Exit"<<endl;
	
	fflush(stdin);
    choice = _getche();
    
    system("cls");
    recsize = sizeof(choice);
    
	switch(choice)
	{
		case '1':
			information();
			break;
		case '2':
			inventory();
			break;
		case '3':
			donation();
			break;
		case '4':
			planner();
			break;
		case '5':
			exit(1);
			break;
	}
}

//menu list
void information()
{

char choice, another;
long int recsize;
	while(1)
	{
	
	system("cls");
	system("title MEMBER INFORMATION");
	system("color 0f");
	cout<<"[1]Add members"<<endl;
	cout<<"[2]Search for members"<<endl;
	cout<<"[3]Edit an existing member information"<<endl;
	cout<<"[4]Display all members"<<endl;
	cout<<"[5]Back to main menu"<<endl;
	
	fflush(stdin);
    choice = _getche();
    
    system("cls");
    recsize = sizeof(choice);
	switch(choice)
	{
		case '1':
			add_();
			break;
		case '2':
			search_();
			break;
		case '3':
			edit_();
			break;
		case '4':
			display_();
			break;
		case '5':
			system("cls");
			menulist();
			break;
	}
}
}

//information menu
void add_()
{
	system("cls");
	system("title ADD");
	system("color 0f");
	
    
	ofstream newmember;
	newmember.open("Member information.dat",ios::app|ios::out);
	cout<<"First name(if 2 words sperate it with ,): ";
	cin>>person.fname;
	cout<<"Middle name name: ";
	cin>>person.mname;
	cout<<"Last name: ";
	cin>>person.lname;
	cout<<"Age: ";
	cin>>person.age;
	cout<<"Sex: ";
	cin>>person.sex;
	cout<<"Birtday: ";
	cin>>person.birthday;
	cout<<"Adrress: ";
	cin>>person.address;
	cout<<"Occupation: ";
	cin>>person.occupation;
	cout<<"Salary: ";
	cin>>person.salary;
	cout<<"# Family Members: ";
	cin>>person.familymembers;
	cout<<"Cellphone Numer: ";
	cin>>person.cpnumber;
	
	newmember<<"\nName: "<<person.fname<<" "<<person.mname<<" "<<person.lname
	<<"\n"<<"Age: "<<person.age<<"\n"<<"Sex: "<<person.sex<<"\n"<<"Birthday: "
	<<person.birthday<<"\n"<<"Address: "<<person.address<<"\n"<<"Occupation: "
	<<person.occupation<<"\n"<<"Salary: Php"<<person.salary<<"\n"<<"Numer of family: "
	<<person.familymembers<<"\n"<<"Cellphone #: "<<person.cpnumber<<"\n___________________";
	
	newmember.close();
	cin.get();
	system("cls");
	information();
}
void display_()
{
	system("title Display All");
	system("color 0f");
	system("cls");
	
	ifstream ifs;
	ifs.open ("Member information.dat");
	char c = ifs.get();
	while (ifs.good()) {
    std::cout << c;
    c = ifs.get();
	}
	ifs.close();
	getch();
	system("cls");
	information();
}
void edit_()
{
	string str_search;
	ostringstream text;
	ifstream in_file("Member information.day");
	
	text<< in_file.rdbuf();
	string str = text.str();
	string str_found = "Mark";
	string str_replace = "Ulaga";
	size_t pos = str.find(str_search);
	str.replace(pos,string(str_search).length(),str_replace);
	in_file.close();
	
	ofstream out_file("Member information.dat");
	out_file<<str;
	getch();
	
}
void search_(){
	int str;
	
	ifstream newmember("Member information.dat");
	
	cout<<"Enter name: ";
	cin>>str;

	
}
void displaymember()
{
	system("cls");
	system("title Results");
	system("color 0f");
	
	cout<<"\nName: "<<person.fname<<" "<<person.mname<<" "<<person.lname
	<<"\n"<<"Age: "<<person.age<<"\n"<<"Sex: "<<person.sex<<"\n"<<"Birthday: "
	<<person.birthday<<"\n"<<"Address: "<<person.address<<"\n"<<"Occupation: "
	<<person.occupation<<"\n"<<"Salary: Php"<<person.salary<<"\n"<<"Numer of family: "
	<<person.familymembers<<"\n"<<"Cellphone #: "<<person.cpnumber;
	
	getch();
}

//------------------------------------------------------------------------------------


void inventory()
{
	char choice;
	long int recsize;
	system("cls");
	system("title INVENTORY");
	system("color 0f");
	cout<<"[1]Add item"<<endl;
	cout<<"[2]Search item"<<endl;
	cout<<"[3]Edit item and delete item"<<endl;
	cout<<"[4]Display all item"<<endl;
	cout<<"[5]Back to main menu";
	
	fflush(stdin);
    choice = _getche();
    
    system("cls");
    recsize = sizeof(choice);
	switch(choice)
	{
		case '1':
			inventoryadd();
			break;
		case '2':
			break;
		case '3':
			break;
		case '4':
			displayinvent();
			break;
		case '5':
			system("cls");
			menulist();
			break;
	}	
}


//inventory menu
void inventoryadd()
{
	system("cls");
	system("title Add item");
	system("color 0f");
	
	cout<<"\nEnter item name: ";
	cin>>item.itemn;
	cout<<"Enter item code: ";
	cin>>item.itemcode;
	cout<<"\nEnter item quantit: ";
	cin>>item.quantity;
	cout<<"\nEnter estimated amount of the item: "<<endl;
	cin>>item.price;
	
	ofstream inventoryitem("Inventory.dat",ios::app);
	
	inventoryitem<<"Item code: "<<item.itemcode<<"\nItem name: "<<item.itemn<<"\n"
	<<"Item quantity: "<<item.quantity<<"\n"<<"Item estimated amount: "<<item.price;
	inventoryitem.close();
	
}
void displayinvent()
{
	system("title Display all Item");
	system("color 0f");
	system("cls");
	ifstream ifs;
	ifs.open ("inventory.dat");
	char c = ifs.get();
	while (ifs.good()){
    std::cout << c;
    c = ifs.get();
  }
  ifs.close();
  getch();
  inventory();
}






//-----------------------------------------------------------------------------------




void planner()
{
	char choice;
	long int recsize;
	system("cls");
	system("title PLANNER");
	system("color 0f");
	
	cout<<"[1]Add plans"<<endl;
	cout<<"[2]Edit plans"<<endl;
	cout<<"[3]search plans"<<endl;
	cout<<"[4]View all plans"<<endl;
	cout<<"[5]View calendar"<<endl;
	cout<<"[6]Back to main menu";
	fflush(stdin);
    choice = _getche();
    
    system("cls");
    recsize = sizeof(choice);
	switch(choice)
	{
		case '1':
			addplans();
			break;
		case '2':
			
			break;
		case '3':
			break;
		case '4':
			viewplans();
			break;
		case '5':
			break;
		case '6':
			system("cls");
			menulist();
			break;
	}
}
void addplans(){
	
	system("cls");
	system("title");
	system("color 0f");
	
	ofstream event("plans.dat",ios::app);
	
	cout<<"Enter events name: ";
	cin>>day.event;
	cout<<"Date of the event: ";
	cin>>day.date;
	cout<<"Address";
	cin>>day.address;
	cout<<"Event description";
	getline(cin,day.description);
	
	event<<"Event name: "<<day.event<<"\n"<<"Event date: "<<day.date
	<<"\n"<<"Address of the event: "<<day.address<<"\n"<<"Plan description: \n"
	<<day.description<<"\n---------------------------";
	event.close();
	cin.get();
	system("cls");
	planner();
	
}
void viewplans(){
	system("title Display");
	system("color 0f");
	system("cls");
	
	ifstream ifs;
	ifs.open ("plans.dat");
	char c = ifs.get();
	while (ifs.good()){
    cout<<c;
    c = ifs.get();
  }
  ifs.close();
  
  getch();
  planner();
}

//-----------------------------------------------------------------------------------


void donation()
{
	char choice;
	long int recsize;
	system("cls");
	system("title DONATION");
	system("color 0f");
	
	cout<<"[1]Information of donatetor"<<endl;
	cout<<"[2]Edit donations"<<endl;
	cout<<"[3]Search donation"<<endl;
	cout<<"[4]View all donation"<<endl;
	cout<<"[5]Back to main menu"<<endl;
	
	fflush(stdin);
    choice = _getche();
    
    system("cls");
    recsize = sizeof(choice);
	
	switch(choice)
	{
		case '1':
			donateinfo();
			break;
		case '2':
			break;
		case '3':
			break;
		case '4':
			displaydonate();
			break;
		case '5':
			system("cls");
			menulist();
			break;
	}
}

//Donation menu

void donateinfo()
{
	ofstream donatetorinfo("Donatetorinfo.dat",ios::app);
	
	cout<<"Full Name exp(F/M/L,seperated with ","): ";
	cin>>donate.fullname;
	cout<<"Address exp(San,Gregorio,Malvar,Batangas): ";
	cin>>donate.address;
	cout<<"Amount of donation: ";
	cin>>donate.amount_of_donation;
	cout<<"Cellphone number: ";
	cin>>donate.number;
	
	donatetorinfo<<"\nName: "<<donate.fullname<<"\n"<<"Address: "<<donate.address
	<<"Amount of Donation: "<<donate.amount_of_donation<<"\nCell no: "<<donate.number;
	donatetorinfo.close();
	system("cls");
	cin.get();
	donation();
	
}
void displaydonate()
{
	system("title Display");
	system("color 0f");
	system("cls");
	
	ifstream ifs;
	ifs.open ("Donatetorinfo.dat");
	char c = ifs.get();
	while (ifs.good()){
    cout<<c;
    c = ifs.get();
  }
  ifs.close();
  
  getch();
  donation();
}</iomanip></conio.h></cstdlib></cstring></cstdio></time.h></windows.h></sstream></conio.h></fstream></iomanip></string></iostream>
Posted
Updated 26-Oct-15 11:09am
v2
Comments
jeron1 26-Oct-15 17:12pm    
You are going to need to be a lot more specific about what you want and what your code doesn't do. Not too many people are going to read that much code in an attempt to figure out what is going on.
Patrice T 26-Oct-15 17:23pm    
You are going to need to be more specific in your question. Remember that we don't see your screen, we don't read your mind, you did not specify what is the problem.
ZurdoDev 26-Oct-15 19:56pm    
What?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900