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
MA_775_DIABLO [31]
2 years ago
10

Write the definition of a function named alternator that receives no parameters and returns true the first time it is invoked, r

eturns false the next time it is invoked, then true, false and so on, alternating between true/false on successive invocations.
Computers and Technology
1 answer:
Nataly [62]2 years ago
3 0

Answer:

The solution code is written in C++

  1. bool STATUS = true;
  2. bool alternator ()
  3. {
  4.    if(STATUS){
  5.        STATUS = false;
  6.        return true;
  7.    }else{
  8.        STATUS = true;
  9.        return false;
  10.    }
  11. }

Explanation:

We need a global variable to track the status of true or false (Line 1).

Next, create the function alternator (Line 2) and then check if current status is true, set the status to false but return the previous status boolean value (Line 5-6). At the first time of function invocation, it will return true.

The else block will set the STATUS to true and return the false (Line 7-9).

You might be interested in
The purpose of maintaining a network of digital forensics specialists is to develop a list of colleagues who specialize in areas
Rudiy27

Answer:

True

Explanation:

Computer security is basically divided into three main areas:

  1. Vulnerability/threat assessment and risk management refers to a process that requires the identification, quantification and ranking of a system's possible vulnerabilities.
  2. network intrusion detection and incident response refers to software that detects malicious activity or policy violations, and blocks them
  3. digital forensic investigation refers to the process of identifying, recovering and interpreting (or validating) electronic data.

Generally a single individual may specialize in one of these areas, that is why he/she may need help with the others.

8 0
3 years ago
Read 2 more answers
What is the name of the technology that integrates vast data bases with georeferenced data in order to design, plan, and manage
ivanzaharov [21]

Answer:

"Geographic information systems " is the right answer.

Explanation:

  • This is indeed a computer-based method for observing and analyzing current events that are happening on the planet. GIS could enhance teaching and learning begin to understand geographical trends and regularities by relaying completely unconnected information.
  • It represent an experimental field and while the GIS supplier government offers us modern, improved, and quicker technical resources for the computer hardware.
7 0
3 years ago
Input 10 integers and display the following:
LekaFEV [45]

Answer:

// code in C++

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int sum_even=0,sum_odd=0,eve_count=0,odd_count=0;

   int largest=INT_MIN;

   int smallest=INT_MAX;

   int n;

   cout<<"Enter 10 Integers:";

   // read 10 Integers

   for(int a=0;a<10;a++)

   {

       cin>>n;

       // find largest

       if(n>largest)

       largest=n;

       // find smallest

       if(n<smallest)

       smallest=n;

       // if input is even

       if(n%2==0)

       {  

           // sum of even

           sum_even+=n;

           // even count

           eve_count++;

       }

       else

       {

           // sum of odd    

          sum_odd+=n;

          // odd count

          odd_count++;

       }

   }

   

   // print sum of even

   cout<<"Sum of all even numbers is: "<<sum_even<<endl;

   // print sum of odd

   cout<<"Sum of all odd numbers is: "<<sum_odd<<endl;

   // print largest

   cout<<"largest Integer is: "<<largest<<endl;

   // print smallest

   cout<<"smallest Integer is: "<<smallest<<endl;

   // print even count

   cout<<"count of even number is: "<<eve_count<<endl;

   // print odd cout

   cout<<"count of odd number is: "<<odd_count<<endl;

return 0;

}

Explanation:

Read an integer from user.If the input is greater that largest then update the  largest.If the input is smaller than smallest then update the smallest.Then check  if input is even then add it to sum_even and increment the eve_count.If the input is odd then add it to sum_odd and increment the odd_count.Repeat this for 10 inputs. Then print sum of all even inputs, sum of all odd inputs, largest among all, smallest among all, count of even inputs and count of odd inputs.

Output:

Enter 10 Integers:1 3 4  2 10 11 12 44 5 20                                                                                

Sum of all even numbers is: 92                                                                                            

Sum of all odd numbers is: 20                                                                                              

largest Integer is: 44                                                                                                    

smallest Integer is: 1                                                                                                    

count of even number is: 6                                                                                                

count of odd number is: 4

3 0
3 years ago
Linda installed a special pool for the hydrotherapeutic treatment of severe arthritis, as prescribed by her doctor. The cost of
stellarik [79]

Answer:

Linda is entitled to deduction (before any AGI limitations) of $896 in one year of installation of the pool.

Explanation:

Following is explained calculation for deduction (before any AGI limitations) that is Linda entitled to in the year of installation of the pool.

Given that:

Cost of Installing the pool = $22,400

Paid by insurance company = $5,600

So by deducting the price paid by insurance company from total cost the balance becomes:

Balance = $22,400 - $5,600 = $ 16,800

As the pool increased the value of house by $7,840 so we will deduct this amount from balance:

Balance = $ 16,800 - $7,840 = $8,960

As the useful life given for pool is 10 years so we will divide the balance with 10 to obtain the deduction amount for 1 year:

Deduction amount for one year = $8,960/10 = $8,96

Hence $8,96 will be deducted in one year installation.

i hope it will help you!

7 0
3 years ago
For this programming assignment, you have to write a Java program that tests whether a given input string represents a Valid E-m
Step2247 [10]

Answer:

To check if the email address is correct it should have only one "@" symbol, we have to split the input string by this symbol. The code in java to achieve this is the following:

class Main {

 public static void main(String[] args) {

   String email = "[email protected]";

   String[] email_split = email.split("@");

   long count_a = email.chars().filter(ch -> ch == '@').count();

   if(count_a == 1){

     System.out.println("User name:   "+email_split[0]);

     System.out.println("Domain name: "+email_split[1]);

   }else{

     System.out.println("There is no valid email address.");

   }

 }

}

Explanation:

The explanation of the code is given below:

class Main {

 public static void main(String[] args) {

   String email = "[email protected]"; //input string to evaluate if is valid email

   long count_a = email.chars().filter(ch -> ch == '@').count(); //Count how many times the symbol @ appears

   if(count_a == 1){ //A valid email only contains one at

     String[] email_split = email.split("@"); //separate the values using the at in an array

     System.out.println("User name:   "+email_split[0]); //the first element is the username

     System.out.println("Domain name: "+email_split[1]); //the second element is the domain name

   }else{

     System.out.println("There is no valid email address."); //If there isn´t an at or are more than one then display a message saying the email is not valid

   }

 }

}

8 0
3 years ago
Other questions:
  • Playstation 4 how to change mtu settings
    12·1 answer
  • If a person sends email from a school computer or a business computer, should that message be considered private?
    8·2 answers
  • Functions of barriers include (mark all that apply): A. Define boundaries B. Design layout C. Deny access D. Delay access
    10·1 answer
  • Write a function that takes as input a single integer parameter n and computes the nth Fibonacci Sequence number. The Fibonacci
    8·1 answer
  • How many questions have you seen so far other than this one?
    10·2 answers
  • How do we make a acount
    15·2 answers
  • How many grams are in 100 pounds?
    6·2 answers
  • In the program below, which two variables have the same scope?
    9·2 answers
  • Abby has received a request for a data set of actual data for testing a new app that is being developed. She does not want the s
    13·1 answer
  • scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!