Closed

Code for Program to perform array operations in c++

Code for Program to perform array operations like append, insert, delete, edit, display and search and element in C++

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

main()

{

int array[15];

int no_el;

clrscr();

cout<<"Enter the no of element :";

cin>>no_el;

for(int i=0;i<no_el;i++)

{

cout<<"Enter the element : ";

cin>>array[i];

}

while(1)

{

clrscr();

cout<<endl<<"1. Append";

cout<<endl<<"2. Insert";

cout<<endl<<"3. delete by value";

cout<<endl<<"4. edit";

cout<<endl<<"5. display";

cout<<endl<<"6. search";

cout<<endl<<"7. exit";

cout<<endl<<"Enter your choice : ";

int choice;

cin>>choice;

switch(choice)

{

case 1:

cout<<"Enter the new element : ";

int new_el;

cin>>new_el;

array[no_el]=new_el;

no_el++;

break;

case 2:

cout<<"Enter the position at which you want to insert : ";

int pos;

cin>>pos;

cout<<"Enter the new element : ";

cin>>new_el;

pos--;

for(i=no_el-1;i>=pos;i--)

array[i+1]=array[i];

array[pos]=new_el;

no_el++;

break;

case 3:

cout<<"Enter the value to be search : ";

int key;

cin>>key;

for(pos=0;pos<no_el;pos++)

{

if(array[pos]==key)

break;

}

if(pos==no_el)

{

cout<<"Search key not found";

break;

}

for(i=pos;i<no_el;i++)

array[i]=array[i+1];

no_el--;

break;

case 4:

cout<<"Enter the position to be edit : ";

cin>>pos;

cout<<"Enter the new value for old position : ";

cin>>array[pos-1];

break;

case 5:

cout<<endl;

for(i=0;i<no_el;i++)

cout<<endl<<"The element is : "<<array[i];

break;

case 6:

cout<<"Enter the value to be search : ";

cin>>key;

for(pos=0;pos<no_el;pos++)

{

if(array[pos]==key)

break;

}

if(pos==no_el)

{

cout<<"Search key not found";

break;

}

cout<<"Search key found at : "<<pos+1;

break;

case 7:

return(0);

break;

}

getch();

}

}

Skills: C Programming, C++ Programming

See more: switch case programming, int i, programming break, programming array, cplusplus array, code your, array programming, key programming, programming code, perform, operations, endl, code programming, search display program, append display, programming pos, display program, code pos, switch programming, programming switch, edit code, program code, key code, code display, search program

About the Employer:
( 0 reviews ) kolkata, India

Project ID: #1148190

78 freelancers are bidding on average $40 for this job

srinichal

ready to deliver

$30 USD in 2 days
(63 Reviews)
6.2
HussienSharaf

HI, I m an old C++ expert. Hussien Sharaf

$30 USD in 1 day
(13 Reviews)
5.2
JamesBond49

Please check my PM

$30 USD in 0 days
(5 Reviews)
4.7
somu101

Please check PMB

$100 USD in 2 days
(8 Reviews)
4.9
youssef13

please check PM

$30 USD in 0 days
(2 Reviews)
3.9
vv210576

I beleive I can help you.

$30 USD in 1 day
(5 Reviews)
3.4
sigutis

nothing but a peanut

$30 USD in 1 day
(7 Reviews)
2.4
sherwaniusman

I am very good in c++ coding...waiting for your reply about the requirements of the workk

$30 USD in 1 day
(1 Review)
1.7
charleslewisjose

Hi, I have excellent knowledge of C,C++ and can finish your project with high quality. Regards, Charles

$30 USD in 1 day
(1 Review)
1.7
iyempandian

interested to do

$30 USD in 1 day
(1 Review)
1.2
xRaytas

Student...last year in computer science, quite skilled in C++; this would be a cake walk (1 hour tops)

$30 USD in 1 day
(0 Reviews)
0.0
uscrazycoder

I assure you that if I get this task then I will provide you best quality code.

$30 USD in 2 days
(0 Reviews)
0.0
f5biswajit

I can write any code in C,C++

$30 USD in 2 days
(0 Reviews)
0.0
rickt3r

8 years experience of working in C++. Worked as a freelancer for 4 IT firms and DRDO(defence research and development organisation), India.

$30 USD in 2 days
(0 Reviews)
0.0
uniquecoder1274

Hi, As mentioned your requirement, it will be completed as per your expectation & definitely the work done will be satisfy you.

$100 USD in 6 days
(0 Reviews)
0.0
MahadeHassan

I am a student of Computer Science & Engineering. i can do this as much as possible.

$30 USD in 1 day
(0 Reviews)
0.0
JoePacha

I am a computer engineering student. I can do this task for you in just a few hours ... I'm very skilled in C++,Java,C#,Python & OOP. Not looking for some huge money but I'll finish it for you professionally ;)

$30 USD in 1 day
(0 Reviews)
0.0
simransandhu1203

its very easy i would like to do that

$30 USD in 1 day
(0 Reviews)
0.0
sherwin21990

i have 8 years exp in c/c++ . dont worry i'll do this program. hope to hear from you . thank you.

$30 USD in 1 day
(0 Reviews)
0.0
robertloxy

Please Check private message.

$30 USD in 1 day
(0 Reviews)
0.0