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

GRUP 2 || IF - 43 -05 #286

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ 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 = "MUHAMMAD KHIYARUS SYIAM,BAGJA 9102 KURNIAWAN"; // put your name here
string ID = "1301194242,1301194020"; // put your student id here
int group_id = 2; // your Group Number here (1-8)


/** FUNCTIONS LIST, DO NOT MODIFY THESE */
Expand Down Expand Up @@ -71,8 +71,17 @@ void insert_last_unique(int arr[], int &n, int x) {

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


bool found = false;
for (int i = 0; i < n && !found; i++){
if (arr[i] == x) {
cout << arr[i] << " " << x;
found = true;
}
}
if (!found){
arr[n] = x;
n++;
}
//-----------------------
}

Expand Down Expand Up @@ -166,10 +175,13 @@ string group_and_average(int arr[], int n) {

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


int sum = 0;
int average;
for (int i=0; i<n; i++)
sum += arr[i];
average = sum/n;
//-----------------------
return "";
return average;
}


Expand All @@ -195,10 +207,9 @@ void view_data_1(int arr[], int n) {
n : number of element inside array
*/

// YOUR CODES HERE
//-----------------------
for(int i=0; i<n; i++) {
cout<<arr[i]<<" ";

for(int i=0; i<=n; i++) {
cout<<arr[n]<<" ";
}
cout<<endl;
//-----------------------
Expand Down
Binary file added main.exe
Binary file not shown.
Binary file added main.o
Binary file not shown.