Recent

Comments

Follow us on Facebook

Tuesday 19 December 2017

write a program to add,update,delete and quit the menu of an array using function in c++

#include <iostream>
using namespace std;

int add(int a[]);
int update(int a[]);
int delet(int a[]);

int main()
{
int arr[5]={0},ss,a,b,c,d,QUIT_CHOICE=4;
cout<<"OPTIONS: "<<endl<<endl;
ii:
cout<<endl<<endl<<"press 1 for adding."<<endl;
cout<<"press 2 for updating value."<<endl;
cout<<"press 3 for deleting value."<<endl;
cout<<"press 4 for quit the program"<<endl;
cout<<"select option.";
cin>>ss;
if (ss != QUIT_CHOICE)
{
 
switch(ss)
{
case 1:
add(arr);
break;

case 2:
b=update(arr);
break;

case 3:
c=delet(arr);
break;



}

     
cout<<"array elements are:";
for(int i=0; i<5; i++)
{
cout<<arr[i]<<"\t";
}
goto ii;
while (ss != QUIT_CHOICE);
         return 0;

}}
int add(int a[5])
{
int i,num;
cout<<"enter index on which the number is to be add:";
cin>>i;
cout<<"enter value to add: ";
cin>>num;
a[i]=a[i]+num;

return a[5];
}

int update(int a[5])
{

int i;
cout<<"enter index number which you want to update:";
cin>>i;
cout<<endl<<"enter updated value: ";
cin>>a[i];

return a[5];
}

int delet(int a[5])
{

int i;
cout<<"enter index number which you want to delet:";
cin>>i;
cout<<endl<<"enter 0 to delet value: ";
cin>>a[i];

return a[5];
}














































0 on: "write a program to add,update,delete and quit the menu of an array using function in c++"

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix.

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix. ...

propeller ads

PropellerAds