write a program to insert an element into an array
Answers were Sorted based on User's Feedback
Answer / dhaivat
void arrayins(int arr[], int& n, int pos, int item)
{
if (n==MAX) //Size of array is MAX
cout<<"Overflow\n";
else
{
for (int x=n; x>=pos; x--)
arr[x+1]=arr[x];
arr[pos]=item;
n++;
cout<<item<<" inserted in the array\n";
}
| Is This Answer Correct ? | 17 Yes | 47 No |
Answer / gokul balaji
#include<iostream.h>
#include<conio.h>
void main()
{
int a[5],i;
for(i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
cout<<a[i];
}
}
| Is This Answer Correct ? | 15 Yes | 66 No |
Answer /
import java.util.*;
import java.io.*;
public class project
{
public static void main (String[]args) throws
IOException
{
BufferedReader dataIn = new BufferedReader
(new InputStreamReader(System.in));
System.out.println
("******************************");
System.out.println("
+++++++++++++++ ");
System.out.println(" [1]
Insert ");
System.out.println(" [2]
Delete ");
System.out.println(" [3]
Search ");
System.out.println(" [4]
Sort ");
System.out.println("
+++++++++++++++ ");
System.out.println
("******************************");
}
}
| Is This Answer Correct ? | 20 Yes | 81 No |
#include<iostream.h>
#include<conio.h>
void main()
{
int a[5];
int i;
clrscr();
cout<<"enter the elements into an array";
for(i=0;i<5;i++)
{
cin>>a[i];
}
getch();
}
| Is This Answer Correct ? | 103 Yes | 171 No |
Answer / namitha
#include<iostream.h>
main()
{
int a[20];
cout<<"enter an element into the array:";
cin>>a[0];
}
| Is This Answer Correct ? | 13 Yes | 89 No |
Answer / vineeshtkm
main()
{
int a[10],item;
cout<<"Enter Item:";
cin>>item;
a[0]=item;
}
| Is This Answer Correct ? | 74 Yes | 189 No |
Can we remove an element in a single linked list without traversing? Lets suppose the link list is like this 1 2 3 4 5 6 We need to remove 4 from this list (without traversing from beginning) and the final link list shud be 1 2 3 5 6 only thing we know is the pointer to element "4". How can we remove "4" and link "3" to "5"?
How is memory managed in C++?
What do you understand by a pure virtual member function?
Can we declare destructor as static? Explain?
What are pointer-to-members in C++? Give their syntax.
How would you call C functions from C++ and vice versa?
What is the c++ code?
write a program to add two numbers without using an arithmetic operator.
What is static in c++?
What it is and how it might be called (2 methods).
In how many ways we can initialize an int variable in C++?
What does new return if there is insufficient memory to make your new object?