Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GROUP 7) IF-43-05 #285

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
27 changes: 21 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ using namespace std;


/** WRITE DOWN YOUR INFORMATION HERE */
string name = ""; // put your name here
string ID = ""; // put your student id here
int group_id = 0; // your Group Number here (1-8)

string name = " "; // put your name here
string ID = " "; // put your student id here
int group_id = 7; // your Group Number here (1-8)


/** FUNCTIONS LIST, DO NOT MODIFY THESE */
Expand Down Expand Up @@ -103,7 +104,8 @@ void insert_last(int arr[], int &n, int x) {

// YOUR CODES HERE
//-----------------------

arr[n]=x;
n=n+1;

//-----------------------
}
Expand All @@ -119,8 +121,20 @@ void search_and_delete(int arr[], int &n, int x) {

// YOUR CODES HERE
//-----------------------


int temp;
for (int i = 0; i < n; i++)
{
if (arr[i] == x)
{
for (int j = i; j < (n-1); j++)
{
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j+1] = temp;
}
n--;
}
}
//-----------------------
}

Expand Down Expand Up @@ -152,6 +166,7 @@ string count_and_sum(int arr[], int n) {
//-----------------------



//-----------------------
return "";
}
Expand Down