From 2b2a671bc0e3947c6eafbd8540381f87d50eed90 Mon Sep 17 00:00:00 2001 From: ashish336652 <51014196+ashish336652@users.noreply.github.com> Date: Sun, 13 Oct 2019 22:22:39 +0530 Subject: [PATCH 1/2] hello --- ab.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 ab.c diff --git a/ab.c b/ab.c new file mode 100644 index 0000000..3bb1711 --- /dev/null +++ b/ab.c @@ -0,0 +1,7 @@ +#include +#include +int main() +{ + printf("hello world"); +} + From 5ccc335ab379e62638bd03dee0e5f5d2fb02d49b Mon Sep 17 00:00:00 2001 From: ashish336652 <51014196+ashish336652@users.noreply.github.com> Date: Sun, 13 Oct 2019 22:56:42 +0530 Subject: [PATCH 2/2] booth.cpp --- booth.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 booth.cpp diff --git a/booth.cpp b/booth.cpp new file mode 100644 index 0000000..35844bc --- /dev/null +++ b/booth.cpp @@ -0,0 +1,66 @@ +#include +#include +#include + +using namespace std; + +class booth{ + private: + float f_id; + float wt; + float grade; + float rate; + float price; + public: + void in(){ + cout<<"Enter farmer id: "; + cin>>f_id; + cout<<"Enter weight in quintal of crop: "; + cin>>wt; + cout<<"Enter its quality(between 1-3): "; + cin>>grade; + cout<<"Enter rate: "; + cin>>rate; + } + void process(){ + int x=grade; + switch(x){ + case 1: price=wt*3/5*rate; + break; + case 2: price=wt*4/5*rate; + break; + case 3: price=wt*rate; + break; + default:cout<<"wrong input of quality "; + break; + + } + cout<<"Payment to farmer: "<>a; + if(a=='y'||a=='Y') + { + booth b; + b.in(); + b.process(); + ofstream fout; + fout.open("data.dat",ios::out|ios::binary|ios::app); + fout.write((char*)&b, sizeof (b)); + fout.close(); + } + else if(a=='n'||a=='N') + exit(1); + else + cout<<"Wrong input, try again"; + system("pause"); + } + return 0; +}