NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class PMS {
char iname[30];
char icode[20];
char edate[10];
char comp[40];
int qty;
float rt, dis, pr;
public:
PMS() {
qty = 0;
rt = 0;
dis = 0;
pr = 0;
}
void get_data();
void addfile();
void display_stock();
void delete_allitem();
} item;
void PMS::delete_allitem()
{
ofstream h;
h.open("stock.txt", std::ofstream::out | std::ofstream::trunc);
h.close();
cout<<"data is deleted successfully"<<endl;
}
void PMS::display_stock()
{
string line;
fstream file;
file.open("stock.txt",std::ios::in);
if(file.is_open())
{
while(getline(file,line))
{
cout<<line<<endl;
}
file.close();
}
}
void PMS::get_data() {
cout << "n****************** Type Item's details Here ******************";
cout << "nItem name:";
cin.ignore();
cin.getline(iname, 30);
cout << "nItem code:";
cin.getline(icode, 20);
cout << "nItem expiry date(DD/MM/YYYY):";
cin.getline(edate, 10);
cout << "nCompany name:";
cin.getline(comp, 40);
cout << "nQuantity:";
cin >> qty;
cout << "nrate of item:";
cin >> rt;
cout << "ndiscount ratio in %:";
cin >> dis;
pr = rt - (rt * dis / 100);
cout << "nitem price:" << pr;
cout << "nnmedicine stored successfully! press any key to continuen";
}
void PMS::addfile()
{
ofstream my_file("stock.txt",ios::app);
my_file<<"item name"<<"t"<<"item code"<<"t"<<"edate"<<"t"<<"company"<<"t"<<"quantity"<<"t"<<"rate of item"<<"t"<<"discount"<<"t"<<"item price"<<"n";
my_file<<iname<<"tt"<<icode<<"tt"<<edate<<"tt"<<comp<<"tt"<<qty<<"tt"<<rt<<"tt"<<dis<<"tt"<<pr<<"ttn";
}
class sale
{
char sdate[15];
char iname[25];
int qty;
public:
void get_saledata();
void write_saledata();
void delete_allsalesitems();
}sitem;
void sale::delete_allsalesitems()
{
ofstream h;
h.open("sale.txt", std::ofstream::out | std::ofstream::trunc);
h.close();
cout<<"data is deleted successfully"<<endl;
}
void sale::get_saledata()
{
system("cls");
cout<<"ttttt******************* Medicine Sale Page *******************n ";
cout<<"nEnter Sale Date:n";
cin.ignore();
cin.getline(sdate,sizeof(sdate));
cout<<"nEnter Medicine Name:n";
cin.getline(iname,20);
cout<<"nEnter Quantity Sold:n";
cin>>qty;
cout<<"nMedicine Sold successfully!n";
cout<<"nPress any key to continuen";
}
void sale::write_saledata()
{
ofstream my_file("sale.txt",ios::app);
my_file<<"sale datettt"<<"Medicine namettt"<<"Quantity soldn";
my_file<<sdate<<"tt"<<iname<<"tt"<<qty<<"n";
my_file.close();
}
int main() {
int ch;
string username;
string password;
cout<<"ttttttt********************************************n";
cout<<"tttttttWELCOME TO NAVTEJ AND VANSH PHARMACY COMPANYn";
cout<<"ttttttt********************************************nnn";
cout<<"ttttttt-----------------PLEASE LOGIN---------------n";
cout<<"ENTER THE USERNAME"<<endl;
cin>>username;
jump2:
cout<<"ENTER THE PASSWORD"<<endl;
cin>>password;
if(password == "password")
{
system("cls");
while (1) {
cout<<"ttttttt********************************************n";
cout<<"tttttttWELCOME TO NAVTEJ AND VANSH PHARMACY COMPANYn";
cout<<"ttttttt********************************************n";
cout<<"!!!!!MENU!!!!!n";
cout << "n1. Add New Medicine";
cout << "n2. Display the Stock";
cout << "n3. Delete all item from the Stock";
cout << "n4. Medicine sale";
cout << "n5. Delete all item from sale";
cout << "n6. Quit";
cout << "nnType Your choice (1-5):";
fflush(stdin);
cin >> ch;
switch (ch) {
case 1:
item.get_data();
item.addfile();
break;
case 2:
item.display_stock();
break;
case 3:
item.delete_allitem();
break;
case 4:
sitem.get_saledata();
sitem.write_saledata();
break;
case 5:
sitem.delete_allsalesitems();
break;
case 6:
goto out;
break;
default:
cout << "n invalid choice";
}
}
out:
cout << "nnPlease wait application is exiting! Press any key";
return 0;
}
else
{
cout<<"SORRY! PASSWORD IS INCORRECT ..TRY AGAINn";
goto jump2;
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.