subject

Partially-filled Arrays Write the function rindby() which stands for remove mark>if not divisiby by. The function removes all elements from the array that are not evenly divisible by the argument n. You can find out if a number is evenly divisible by n using the remainder operator: % (there will be nothing left over).
The function returns the number of items removed or -1 if the array was originally empty.
The function takes 3 arguments:
the array of int that may be modified.
the size of the array (use size_t as the type)
the int n used to check for divisibility
Here are two short examples:
int a[] = {2, 3, 4, 5, 6};
size_t size = 5;
int removed = rindby(a, size, 2);
// removed->2, a = [2, 4, 6], size = 3
size = 0;
removed = rindby(a, size, 3);
// removed-> -1, no change otherwise
In the first case, the numbers 3 and 5 are removed because they are not divisible by 2. Only the numbers that are divisible by 2 are left in the array.
In the second, size has been set to , so the input array is empty and the function returns - 1.
Exam C++ Quick Reference
p1.cpp
1 #include // size_t for sizes and indexes
2 using namespace std;
3
4 WRITE YOUR FUNCTION BELOW THIS LINE
5 int rindby(int all, size_t& size, int number)
6 {
7 int result;
8 // Add your code here
9 return result;
10 }
11

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:20, karreemgrant2
What is the full meaning of rfid in computer
Answers: 2
image
Computers and Technology, 22.06.2019 01:30, chastineondre7979
How will you cite information that is common knowledge in your research paper?
Answers: 1
image
Computers and Technology, 22.06.2019 10:00, kimmmmmmy333
According to alisa miller foreign news bureaus
Answers: 3
image
Computers and Technology, 22.06.2019 10:30, JeroMii
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
You know the right answer?
Partially-filled Arrays Write the function rindby() which stands for remove mark>if not divisib...

Questions in other subjects: