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
Which of the following questions will most likely be answered by displaying data on a line graph?
Neko [114]
It would be A because B could be answered best with a poll graph, C with a pie graph, and D with a bar graph. Line graphs typically show speed and rate so A makes the most sense, but you are still able to do the other questions on a line graph.
4 0
3 years ago
On laptops with a smart card reader installed, where is the smart card reader usually located?
dem82 [27]
Plenty of space in the palm rest
4 0
3 years ago
The following program draws squares recursively. Fill in the missing code. import javax.swing\.\*; import java.awt\.\*; public c
ExtremeBDS [4]

Answer:

The missing code to this question is g.

Explanation:

In this question firstly import packages. Then declaration of the class Test that inherits the JApplet. In this class, we declare the default constructor. In this constructor, we call the add function. Then we declare another class that is SquarePanel. This class inherits JPanel. In this class, we define a method that is paintComponent(). In this method, we define an integer variable. In this method, we perform calculations and pass it to another function that is displaySquares(). In this function, we pass the value as the arguments. So in question the missing code or argument is g.

8 0
3 years ago
Marcus creates a HTML webpage on his favourite game, football. On clicking the word “football” another website containing the in
igomit [66]

please mark me as the brainlest answer please

if you do it then I will answer your all questions.

4 0
2 years ago
If classes C1 and C2 both implement an interface Cint, which has a method whichIsIt, and if C1 c = new C1( ); is performed at on
Assoli18 [71]

Answer:

FALSE

Explanation:

Because C1 and C2 implement the same interface, they both implement whichIsIt. The variable c is known as a polymorphic variable, meaning that it can change from being an C1 to a C2. So, the message c.whichIsIt( ); may invoke C1's whichIsIt or C2's whichIsIt. This can only be known at runtime.

5 0
3 years ago
Other questions:
  • The CSS relative positioning property called ____ moves the element relative to its original position but preserves the space re
    9·1 answer
  • Maya enjoys connectedWith her friends and social media apps but one of her friends post a lot of stuff that my thinks it’s annoy
    14·1 answer
  • 1. Zack sees an online contest. He could win $10,000 instantly! On the sign-up form, he enters his name and email address. He is
    15·1 answer
  • A group of computers that are interconnected in order to share information or documents is called a _____.
    7·1 answer
  • A technician has been notified of a problem on the network. After investigation, the technician determines that a specific inter
    7·1 answer
  • Describe how you would create a Java program that prompted the user to correctly enter a username and password. The username is
    7·1 answer
  • ¿Es aquel panel que controla la estructura de la tabla dinámica?
    14·2 answers
  • What is not one of the top health concerns in the United States?physical activitymental healthtobacco useaccess to education
    8·1 answer
  • What are some legal issues that can arise from the use of social media?
    10·1 answer
  • Why is technology bad for you
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!