1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ANTONII [103]
4 years ago
11

Given: an int variable k, an int array current Members that has been declared and initialized, an int variable memberID that has

been initialized, and a boolean variable isAMember. Write code that assigns true to isAMember if the value of memberID can be found in current Members, and that assigns false to isAMember otherwise. Use only k, currentMembers, memberID, and isAMember.
Computers and Technology
1 answer:
Alekssandra [29.7K]4 years ago
4 0

Answer:

The c++ program is given below. Nothing is displayed as per the question.

#include <iostream>

using namespace std;

int main() {    

   // declaration and initialization of integer variables

   int k, memberID = 12, nMembers=5;

   bool isAMember;    

   // declaration and initialization of integer array

   int currentMembers[] = {12, 34, 56, 78, 90};    

   for(k=0; k<nMembers; k++)

   {

       if(memberID == currentMembers[k])

       {

           // when member is found in the array, the loop is exited using break

           isAMember = true;

           break;

       }

       else

           isAMember = false;

   }    

   return 0;

}

Explanation:

The program begins with declaration and initialization of integer variables and followed by initialization of the array holding the id of all the members.

The Boolean variable is declared but not initialized.

int k, memberID = 12, nMembers=5;

bool isAMember;

int currentMembers[] = {12, 34, 56, 78, 90};

After this, the array holding the id of the members is searched for the given member id. This is done using  a for loop and a if else statement inside the loop.

If the member id is present in the array, the variable isAMember is initialized to true otherwise it is assigned false.

When the variable isAMember is initialized to true, the break statement is used to exit from the loop.

for(k=0; k<nMembers; k++)

   {

       if(memberID == currentMembers[k])

       {

           isAMember = true;

           break;

       }

       else

           isAMember = false;

 }

The break is used since other values of id in the array will not match the given member id and the variable, isAMember will be initialized to false even if the given member id is present in the array. Hence, it is mandatory to exit the loop once the given member id is found in the array.

This program can be tested for different values of the id of the members and different sizes of the array.

You might be interested in
Your company has an external database of payment information that they wish to populate in Salesforce. They have decided to use
Anettt [7]

Answer:

Option A i.e., Indirect Lookup is the correct option.

Explanation:

In the following statement, a company has a database that is external information of the payment then, they desire to increase the population. Then, they determine that if they use External object and also they use Lightning connect to accomplish the following requirements. Then, finally, they desire to establish an indirect lookup relationship.

3 0
3 years ago
Ethical design refers to...
Travka [436]

Answer:

C. A set of principles dictating that technology should do no harm and seek to improve the human condition

Explanation:

Anything "ethical" refers to being "right" or "just", for example, calling someone a racial slur would not be ethical, but learning a little bit about their culture to understand them better would be ethical

8 0
3 years ago
When you use a business class with an object data source, the business class Group of answer choices must have attributes that m
DedPeter [7]

Answer: must have public properties that match the names of the bound fields

Explanation:

When a business class is used with an object data source, the business class must have public properties that match the names of the bound fields.

Having an attribute which match the names of the bound fields isn't necessary as well as having a constructor with parameters that match the names of the bound fields

Therefore, the correct option is B.

3 0
3 years ago
Universal containers wants to rollout new product bundles with several pricing options. Pricing options include product-price bu
ololo11 [35]

Answer:

a) Custom AppExchange-app for product-pricing

Explanation:

We can find a solution in AppExchange for this product-pricing, surfing in the option, we could get solutions like BoonPlus, and easy pricing Opportunity, this App has a free trial.

With this option is easy to choose a book price, add new products, select pricing rule, we can get an order's product, and calculate pricing, just we must download the app and install it.

6 0
3 years ago
PLEASE ANSWER ASAP
kompoz [17]
D, an acrostic is a "a poem, word puzzle, or other composition in which certain letters in each line form a word or words."
3 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that finds the largest in a series of numbers entered by the user.The program must prompt the user to enter numb
    12·1 answer
  • Once I have entered text into a presentation, how do I modify the font style of the text? Select the text and use options availa
    9·2 answers
  • i have a at&amp;t router and a 1000mbs Ethernet cable connecting from that to my net gear r7000 that can push +1000mbs. the cabl
    14·1 answer
  • Can someone tell me how to use the Human machine language for beginners? or websites I should use.​
    7·1 answer
  • I need help writing this pseudocode
    11·1 answer
  • What type of security software prevents, detects, and removes malware that tries to collect personal information or change compu
    13·1 answer
  • Question #1
    9·2 answers
  • B) Develop a truth table for expression AB+ C.
    10·1 answer
  • Which of these is an example of output?
    13·2 answers
  • Could anyone help me with this assignment please?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!