1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
ifstream inFile;
string empID,name;
int opt;
char level;
char tmp[50];
int mon1,mon2;
double jan1,feb1,mar1,apr1,may1,june1,july1,aug1,sept1,oct1,nov1,dec1;
double jan2,feb2,mar2,apr2,may2,june2,july2,aug2,sept2,oct2,nov2,dec2;
cout<<"Please Enter Employee ID:\n";
getline(cin,empID);
cout<<"Please select category:\n";
cout<<"1)General Items\n";
cout<<"2)Luxurious Items\n";
cin>>opt;
cout<<"Option entered:"<<opt<<endl;
inFile.open("employee.dat",ios::in);
if(inFile.fail())
cout<<"Error opening the file\n";
while(!inFile.eof())
{
getline(inFile,empID);
getline(inFile,name);
inFile>>jan1>>feb1>>mar1>>apr1>>may1>>june1>>july1>>aug1>>sept1>>oct1>>nov1>>dec1;
inFile>>jan2>>feb2>>mar2>>apr2>>may2>>june2>>july2>>aug2>>sept2>>oct2>>nov2>>dec2;
inFile.getline(tmp,100);
if(!inFile.eof())
{
}
inFile.close();
}
if(opt==1)
{
cout<<"Please enter month:\n";
cout<<"1)January 2)February 3)March 4)April\n";
cout<<"5)May 6)June 7)July 8)August\n";
cout<<"9)September 10)October 11)November 12)December\n";
cin>>mon1;
if(mon1==1)
{
cout<<"Jan:"<<jan1<<endl;
}
else if(mon1==2)
{
cout<<"Feb:"<<feb1<<endl;
}
else if(mon1==3)
{
cout<<"Mar:"<<mar1<<endl;
}
else if(mon1==4)
{
cout<<"Apr:"<<apr1<<endl;
}
else if(mon1==5)
{
cout<<"May:"<<may1<<endl;
}
else if(mon1==6)
{
cout<<"June:"<<june1<<endl;
}
else if(mon1==7)
{
cout<<"July:"<<july1<<endl;
}
else if(mon1==8)
{
cout<<"Aug:"<<aug1<<endl;
}
else if(mon1==9)
{
cout<<"Sept:"<<sept1<<endl;
}
else if(mon1==10)
{
cout<<"Oct:"<<oct1<<endl;
}
else if(mon1==11)
{
cout<<"Nov:"<<nov1<<endl;
}
else if(mon1==12)
{
cout<<"Dec:"<<dec1<<endl;
}
}
else if(opt==2)
{
cout<<"Please enter month:\n";
cout<<"1)January 2)February 3)March 4)April\n";
cout<<"5)May 6)June 7)July 8)August\n";
cout<<"9)September 10)October 11)November 12)December\n";
cin>>mon2;
if(mon2==1)
{
cout<<"Jan:"<<jan2<<endl;
}
else if(mon2==2)
{
cout<<"Feb:"<<feb2<<endl;
}
else if(mon2==3)
{
cout<<"Mar:"<<mar2<<endl;
}
else if(mon2==4)
{
cout<<"Apr:"<<apr2<<endl;
}
else if(mon2==5)
{
cout<<"May:"<<may2<<endl;
}
else if(mon2==6)
{
cout<<"June:"<<june2<<endl;
}
else if(mon2==7)
{
cout<<"July:"<<july2<<endl;
}
else if(mon2==8)
{
cout<<"Aug:"<<aug2<<endl;
}
else if(mon2==9)
{
cout<<"Sept:"<<sept2<<endl;
}
else if(mon2==10)
{
cout<<"Oct:"<<oct2<<endl;
}
else if(mon2==11)
{
cout<<"Nov:"<<nov2<<endl;
}
else if(mon2==12)
{
cout<<"Dec:"<<dec2<<endl;
}
}
}
|