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
egoroff_w [7]
3 years ago
12

Given :an int variable k,an int array currentMembers that has been declared and initialized ,an int variable nMembers that conta

ins the number of elements in the array ,an int variable memberID that has been initialized , andan int variable isAMember, write code that assigns 1 to isAMember if the value of memberID can be found in currentMembers, and that assigns 0 to isAMember otherwise. Use only k, currentMembers, nMembers, and isAMember.
Computers and Technology
1 answer:
ipn [44]3 years ago
5 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, 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 = 1;

           break;

       }

       else

           isAMember = 0;

   }

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.

int k, memberID = 12, nMembers=5, 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 1 otherwise it is assigned 0.

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

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

   {

       if(memberID == currentMembers[k])

       {

           isAMember = 1;

           break;

       }

       else

           isAMember = 0;

 }

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 assigned value 0 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.

Also, the value of the variable isAMember is not displayed since it is not mentioned in the question.

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
Which version of Windows was considered an operating environment rather than an operating system?
maksim [4K]
The answer is A. Windows 1.O
4 0
4 years ago
Mel is a research scientist at a health sciences center. His job requires him to analyze large amounts of data in short periods
blondinia [14]

In the case above, Mel needs a  desktop computer with a fast processor.

<h3>What is data for a computer?</h3>

Computer data is known to be a form of information processed or saved by a computer. This information is saved as text documents, images, audio clips, software programs and others.

Hence due to the volume of work and in In the case above, Mel needs a  desktop computer with a fast processor.

See options below

23

Mel is a research scientist at a health sciences center. His job requires him to analyze large amounts of data in short periods of time.

Select the best computer for Mel.



A handheld tablet computer



A desktop computer with two screens



A desktop computer with a fast processor



A portable laptop computer

Learn more about data  from

brainly.com/question/19243813

#SPJ1

4 0
2 years ago
What are the reasons why organizations opt for a certificate
Nata [24]

Answer:

Because it helps you prove that you're you to third parties who wouldn't know otherwise. A CA helps you to establish trust with others because they're trusted for issuing valid, reliable certificates — and that trust is integral to public key infrastructure (PKI).

Explanation:

with this info I believe it is a A and C

6 0
3 years ago
_____ is(are) often used in reports to quickly represent data and help the readers understand the data.
Ira Lisetskai [31]
Tables are used<span> to </span>present <span>numerical </span>data<span> in a wide variety of publications from newspapers, journals and textbooks to the sides of grocery packets.</span>
6 0
4 years ago
Which of the following should get a Page Quality (PQ) rating of Low or Lowest? Select all that apply. True False A page with a m
Vikki [24]

The statement “All queries have only one intent: Know, Do, Website or Visit-in-Person intent” is True.

The statement “The intent of a Do query is to accomplish a goal or engage in an activity on a phone” is True.

The statement “The intent of a Website query is to find information” is True.

The statement “There is absolutely no information about who is responsible for the content of the website on a YMYL topic” is True.

The statement “All the Main Content(MC) of the page is copied and created with deceptive intent” is True.

The statement “A page with a mismatch between the location of the page and the rating location; for example, an English page for an English rating task’ is True.

“A file type other than a web page, for example; a PDF, a Microsoft Word document or a PNG file” is False.

<u>Explanation:</u>

The searcher tries to find out the Know queries. The action is taken by the searcher using the Do queries. The searcher looks for a site/ page using Website queries. The queries which are the same as they appear to be are Visit-in-Person queries.

The statement is true because in Do queries, the action is taken like the control of the smartphone is given to Google.

The search for a page or a site takes place using Website queries.

It is not always true that the Wikipedia pages should get high ratings for all user intents because information is helpful.

There is no surety that who will update the content of the website on a YMTL topic.

The Main Content (MC) of the low quality YMYL page helps the page to achieve its purpose. For YMYL the content is created with deceptive intent. The pages manipulate users to take action which will not help the users .

The PQ rating is lowest when there is a mismatch between the location of the page and the rating location, for example, an English rating task. Here, the purpose of the page is required to be understood to determine the rating.

The PQ rating is not determined by the type of the page but by the purpose of the page.

6 0
4 years ago
Other questions:
  • A5.3 1012 kg satellite is 1,800 m from another satellite that has a mass of 3.5 x 108 kg. What is the gravitational
    6·1 answer
  • If you're unsure if something
    9·2 answers
  • The need to strike a<br>- among work, life, family, and other responsibilities is<br>universal.​
    15·1 answer
  • A(n) __________ describes a set of well-defined logical steps that must be taken to perform a task
    5·1 answer
  • The larget social networking site to date is
    7·1 answer
  • You are setting up your Windows computer to connect to the Internet and notice that when you type www.microsoft, the browser doe
    15·1 answer
  • Uploading Your Work
    14·1 answer
  • A large number of genetic codes are stored as binary values in a list. Which one of the following conditions must be true in ord
    5·2 answers
  • What is a motherboard​
    10·1 answer
  • The ______ process retains copies of data over extended periods of time in order to meet legal and operational requirements.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!