Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c + + Assume an array of sorted integers with Students ID . Write a program to insert few Student IDs in the array

in c++ Assume an array of sorted integers with Students ID. Write a program to insert few Student IDs in the array such that the array remains sorted. Assume an array sid ={1,3,6,8,10} to start with. Solution:
Find out how many user ids need to be inserted Check if those Ids already existing. IF so don't insert them. Just print a message the element if found at the index position If not found, insert them in such a way that the arrays remain sorted #include
using namespace std;
int findId(int, int [], int);
void insertId(int, int [], int);
int main()
{
const int MAX_SIZE =100;
int sid[MAX_SIZE]={1,3,6,8,10};
int index, id;
// To insert more numbers
int num, size =5;
cout << "How many numbers do you want to insert? ";
cin >> num;
cout << "Enter the student ids: ";
/*
Enter your code
*/
cout << "The array with all the elements inserted are: ";
/*
Enter your code
*/
}
// should return the index of val if it is present in the array
// otherwise return -1
int findId(int val, int arrId[], int sz)
{
/*
Enter your code
*/
}
void insertId(int val, int arrId[], int sz)
{
/*
Enter your code
*/
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions

Question

How are lenders remedies limited by law?

Answered: 1 week ago

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago