Project 1
#include<cstring>
#include<fstream>
#include<iostream>
using namespace std;
string mystring;
string Ramu[5][5] ={{"LAPTOP","5"},{"Mouse","5"},{"Headset","10"},{"Bag","5"},{"Adopter","20"}};
string Raju[5][5]={{"LAPTOP","10"},{"Mouse","10"},{"Headset","25"},{"Bag","10"},{"Adopter","15"}};
string Shyam[5][5]={{"LAPTOP","3"},{"Mouse","5"},{"Headset","6"},{"Bag","3"},{"Adopter","10"}};
string vendor1[5][5]{{"LAPTOP","45000"},{"Mouse","1500"},{"Headset","2500"},{"Bag","1200"},{"Adopter","1600"}};
string vendor2[5][5]={{"LAPTOP","43000"},{"Mouse","1200"},{"Headset","3000"},{"Bag","1000"},{"Adopter","1500"}};
#include"common.h"
int main()
{
cout<< "Employee purchase responsibility press 1"<<endl;
cout<< "Enter vendor details 2 to a file "<<endl;
int user_choice;
cin >>user_choice;
if (user_choice==1)
{ cout<<"Ramus responsibility"<<endl;
for(int i=0;i<5;i++)
{
for (int j=0;j<5;j++)
{
cout<<" "<<Ramu[i][j];
}
}cout<<endl;
cout<<"Rajus responsibility"<<endl;
for(int i=0;i<5;i++)
{
for (int j=0;j<5;j++)
{
cout<<" "<<Raju[i][j];
}
}cout<<endl;
cout<<"shyam responsibility"<<endl;
for(int i=0;i<5;i++)
{
for (int j=0;j<5;j++)
{
cout<<" "<<Shyam[i][j];
}
}
}
else if(user_choice==2)
{
cout<<endl;
fstream myfile;
myfile.open("file.dat");
cout << "Enter the vendor name followed by commodity name and price"<<endl;
cout<< "press -1 "<<"if vendor entry is over"<<endl;
while(myfile)
{
getline(cin,mystring);
if (mystring == "-1")
break;
myfile<<mystring<<endl;
}
myfile.close();
}
return 0;
}