You are on page 1of 9

PROGRAMMING C++

Shehab Mohamed 20210827


PROGRAMMING C++
Mahmoud hamada 20210860

Sayed yosry 20210829


Students of project
Nabil elsayed 20210868

Submit to:
Dr/ Mohamed Ghoboushi
back next
//case 2 search1 id
#include <iostream> Next: case 2:
#include <fstream> cout<<"please enter the {
#include <string> case 1 for store case 2 for cout<<"Please enter the code you
using namespace std; search ID"<<endl;
search ID ,case 3 for
// function prototype cin>>ID;
void store(void); productcode ,case 4 edit1 for
int index=search1(ID);
int search1(int); id ,case 5 edit2 for cout<<index<<endl;
int search2(int); product_code , case 6 delete1 if(index!=-1)
void edit1(int); for id , case 7 delete2 for {
void edit2(int); product ,case 8 for end cout<<"the data are\n"<<endl;
void delete1(int); "<<endl;
void delelte2(int) cin>>number; cout<<"Name:"<<Name[index]<<endl;
//public declaration
string Name[5]; cout<<"Age:"<<Age[index]<<endl;
string Email[5]; cout<<"*******************
string Gender[5]; ***\n"; cout<<"Gender:"<<Gender[index]<<endl;
string product_name[5]; switch(number)
int product_code[5]; { cout<<"Email:"<<Email[index]<<endl;
int product_price[5]; cout<<"id:"<<id[index]<<endl;
//case 1 store
int id[5]; case 1: cout<<"sallrry:"<<sallrry[index]<<endl;
int Age[5];
{
float sallrry[5];
int main() store(); cout<<"====================="<<endl;
break; }
{ else
int numberproduct; }
cout<<"there are no data"<<endl;
int ID; break;
int number; }
int E_id;
int E_product;
int D_id;
back next
int D_product;
//case 3 search2 product
//case 4 edit1 id //case 6 delete1 id
case 3:
case 4: case 6:
{
{
cout<<"Please enter the you search {
cout<<"please enter the
productcode"<<endl; cout<<"please enter id that you need to delete1 it\n";
cin>>numberproduct; the id that you need to edit it\n"; int D_id;
int
index=search2(numberproduct);
int E_id; cin>>D_id;
cin>>E_id; delete1(D_id);
cout<<index<<endl;
edit1(E_id); break;
if(index!=-1)
{ break; }
cout<<"the data are\n"<<endl; } case 7:
//case 5 edit2 product //case 7 delete product
cout<<"productname:"<<product_name[inde
x]<<endl;
case 5: {
{ cout<<"please enter the
cout<<"productcode:"<<product_code
id that you need to delete1 it\n";
[index]<<endl; cout<<"please enter
int D_product;
cout<<"productprice:"<<product_price the id that you need to edit it\n"; cin>>D_product;
[index]<<endl; int E_product; delete2(D_product);
cout<<"====================="<<endl;
cin>>E_product; break;
}
else edit2(E_product); }
break; //case 8 end
{
case 8:
cout<<"there are no data"<<endl; }
return 0;
cout<<"====================="<<endl;
}
}
cout<<"\a";
break;
goto Next;
}
return 0;
}
back next
//store function
void store() for(int i=0;i<3;i++) for(int i=0;i<3;i++)
{ { {
ofstream fout; cout<<"please enter the cout<<"Name:"<<Name[i]<<endl;
fout.open("prog.txt",ios::app); product name"<<endl; cout<<"Age:"<<Age[i]<<endl;
for(int i=0;i<3;i++) cin>>product_name[i];
{ cout<<"please enter the cout<<"Gender:"<<Gender[i]<<endl;
cout<<"please enter your product code"<<endl; cout<<"Email:"<<Email[i]<<endl;
name"<<endl; cout<<"id:"<<id[i]<<endl;
cin>>product_code[i];
cin>>Name[i]; cout<<"sallrry:"<<sallrry[i]<<endl;
cout<<"please enter the
cout<<"please enter your age"<<endl; cout<<"====================\
cin>>Age[i]; product price"<<endl;
n";
cout<<"please entr your gender for cin>>product_price[i];
}
male or female "<<endl; for(int i=0;i<3;i++)
cin>>Gender[i]; cout<<"**********************\n"; {
cout<<"please enter yore fout<<product_name[i]<<"\t\t\
Email"<<endl; t"<<product_code[i]<<"\t\t\ cout<<"productname:"<<product_name[i]
cin>>Email[i]; t"<<product_price[i]<<endl; <<endl;
cout<<"please enter your id"<<endl;
cin>>id[i]; fout<<"***************************** cout<<"productcode:"<<product_code[i]<
cout<<"please enter your ********************"<<endl; <endl;
sallrry"<<endl;
}
cin>>sallrry[i];
fout<<Name[i]<<"\t\t\
fout.close(); cout<<"productprice:"<<product_price[i]
t"<<Age[i]<<"\t\t\t"<<Gender[i]<<"\t\t\ <<endl;
t"<<Email[i]<<"\t\t\t"<<id[i]<<"\t\t\
t"<<sallrry[i]<<endl; cout<<"====================\n";
fout<<"======================"<<endl; }
} }
back next
// case 2 edit age
// search id function // Edit1 id function case 2:
int search1(int ID) void edit1(int E_id) {
{ { cout<<"please enter the new Age "<<endl;
for(int i=0;i<3;i++) int k=search1(E_id); cin>>Age[k];
int edition_1; cout<<"new
{ Age:"<<Age[k]<<endl;
Next_1:
if(id[i]==ID) cout<<"==================="<<endl;
cout<<"please enter the case 1
break;
for edit name , case 2 for edit Age , case 3
return i; }
for edit Gender , case 4 for edit Email ,case // case 3 edit Gender
} 5 for edit id , case 6 for edit sallrry ,case 7 case 3:
} for end "<<endl; {
// search product function cin>>edition_1; cout<<"please enter the new
int search2(int switch(edition_1) Gender "<<endl;
numberproduct) { cin>>Gender[k];
// case 1 edit name cout<<"new
{ Gender:"<<Gender[k]<<endl;
for(int i=0;i<3;i++) case 1:
{ { cout<<"=================="<<endl;
cout<<"please enter the break;
new name "<<endl; }
if(product_code[i]==numberproduct) cin>>Name[k]; //case 4 edit email
return i; cout<<"new case 4:
} Name:"<<Name[k]<<endl; {
} cout<<"please enter the new
Email "<<endl;
cout<<"==========================
cin>>Email[k];
================"<<endl; cout<<"new
Email:"<<Email[k]<<endl;
break; cout<<"==================="<<endl;
} break;
back next }
//case 5 edit id // Edit2 product function //case 2 product_code
case 5: void edit2(int E_product) case 2:
{ { {
cout<<"please enter the new id int k=search2(E_product); cout<<"please enter the new productcode
"<<endl;
int edition_2; "<<endl;
cin>>id[k];
Next_2: cin>>product_code[k];
cout<<"new id:"<<id[k]<<endl;
cout<<"please enter the case 1 for edit cout<<"new
cout<<"================"<<endl; nameproduct , case 2 for edit productcode , case 3 productcode:"<<product_code[k]<<endl;
for edit productprice ,case 4 for end "<<endl; cout<<"==============="<<endl;
break; cin>>edition_2; break;
} switch(edition_2) }
//case 6 edit sallrry { //case 3 product_price
case 6: //case 1 product_name case 3:
{ case 1: {
cout<<"please enter the new { cout<<"please enter the new
sallrry "<<endl;
cout<<"please enter the new nameproduct productprice "<<endl;
cin>>sallrry[k];
"<<endl; cin>>product_price[k];
cout<<"new
sallrry:"<<sallrry[k]<<endl; cin>>product_name[k]; cout<<"new
cout<<"new productprice:"<<product_price[k]<<endl;
cout<<"=================="<<endl; nameproduct:"<<product_name[k]<<endl;
cout<<"========================"<<endl; cout<<"============================
break; break; ="<<endl;
} } break;
//case 7 end }
case 7: //case 4 end
return; case 4:
}
return ;
goto Next_1;
}
} back next goto Next_2;
}
// delete1 function
void delete1(int D_id) //delete2 function
{ void delete2(int D_product)
int k=search1(D_id); {
Name[k]="0"; int k=search2(D_product);
cout<<"Name:"<<Name[k]<<endl; product_name[k]="0";
Age[k]=0;
cout<<"Age:"<<Age[k]<<endl; cout<<"product_name:"<<product_name[k
Gender[k]="0"; ]<<endl;
cout<<"Gender:"<<Gender[k]<<endl; product_code[k]=0;
Email[k]="0";
cout<<"Email:"<<Email[k]<<endl; cout<<"product_code:"<<product_code[k]
id[k]=0; <<endl;
cout<<"id:"<<id[k]<<endl; product_price[k]=0;
sallrry[k]=0;
cout<<"sallrry:"<<sallrry[k]<<endl; cout<<"product_price:"<<product_price[k]
return ; <<endl;
} return ;
}

back next
finsh

You might also like