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
Lina20 [59]
3 years ago
10

Write the definition of a function named newbie that receives no parameters and returns true the first time it is invoked (when

it is a "newbie"), and that returns false every time that it is invoked after that.
Computers and Technology
1 answer:
kondaur [170]3 years ago
7 0

Answer:

The function definition to this question can be described as follows:

bool newbie() //defining a bool method newbie

{

static bool y = true ; // defining a static bool variable y and assign value true

bool t1=y; //defining bool variable t1 and assign value of variable y

y=false; // assigning value in variable y

return t1; // return value of variable t1

}

Explanation:

The program to this question can be described as follows:

Program:

#include <iostream> //defining header file

using namespace std;

bool newbie() //defining a bool method newbie

{

static bool y = true ; // defining a static bool variable y and assign value true

bool t1=y; //defining bool variable t1 and assign value of variable y

y=false; // assigning value in variable y

return t1; // return value of variable t1

}

int main() //defining main method

{

int s,s1; //defining integer variable s,and s1

s=newbie(); // variable s that call method

cout<<s<<endl; //print value

s1=newbie();//variable s that call method

cout<<s1;  //print value

return 0;

}

Output:

1

0

Description:

The description of the above function can be described as follows:

  • In the above method definition a boolean method "newbie" is declared, which can't accept any parameters, inside the method, two boolean variable "y and t1" is declared.
  • In this variable, variable y is a static boolean variable, that assigns a true value, and in t1 variable, we hold static variable value.  
  • In the next step, the "y" variable assigns a value, that is false and returns variable t1 value.
  • In the next step, the main method is declared, inside these two integer variable s, s1 is declared, that calls a method, and prints it value in the first time, it will print 1, that means the false and second time it will print 0, that means false.
You might be interested in
Calculate the cash used to retire debt for each of the six months. Since the company can't pay down more debt than there is cash
BabaBlast [244]

Answer:

The required cash used to retire a debt can be computed as follows:

Cash used to retire debt = cash available to retire a debt, if the cash available to retire debt is less than the loan balance from previous month. Otherwise, cash used to retire debt is equal to the loan balance from previous month.

The excel formula to perform this task is provided as follows:

D33 = IF(D32<C34,D32,C34)

The same formula is used to get the values for E33 to I33.

Explanation:

See the attached picture for table.

5 0
3 years ago
Why the car floated before it started to sink? Explain.​
zhenek [66]

Answer:

it still had air in it

Explanation:

its simple

8 0
3 years ago
____ is an easy way to invitation through a web page​
Agata [3.3K]

Answer:

RSVP?

Explanation:

6 0
3 years ago
Read 2 more answers
Joe wants to use pictures from the internet in a word processing program which is the most important aspect that Joel should con
MrRa [10]
I would say B-copyright.
6 0
4 years ago
Read 2 more answers
Is this a scam pls tell me????????????/
zloy xaker [14]

Yes don't trust at all, I've got that so many times

3 0
4 years ago
Read 2 more answers
Other questions:
  • What is the result of segmenting a network with a bridge (switch)? (Choose two)
    14·1 answer
  • Which type of computer do dedicated gamers and video editors prefer?​
    11·1 answer
  • Explain why living things store energy in lipids instead of in carbohydrates
    5·1 answer
  • Anyone Free to Talk??????? I'm Bored :(
    6·2 answers
  • What computer programs can you work with to present and post your e-portfolio on the Internet?
    11·1 answer
  • Write a program to input value of three sides, to check triangle is triangle is possible to form of not​
    11·1 answer
  • Select the correct answer.
    10·1 answer
  • What technique is used when setup times at a workstation are sequence dependent?
    15·1 answer
  • Taran wants to work in the technology field but is unsure of which career to pursue. He has been told he has strong people skill
    14·1 answer
  • Before a computer can use a router, what configuration information must it be provided?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!