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
Gwar [14]
3 years ago
5

Whenever they are passed as parameters to a function, the IO classes istream and ostream must be passed using a pass-by-referenc

e parameter passing scheme.
Select one:

a. FALSE

b. TRUE
Computers and Technology
1 answer:
morpeh [17]3 years ago
7 0

Answer:

b. TRUE

Explanation:

Whenever they are passed as parameters to a function, the IO classes istream and ostream must be passed using a pass-by-reference parameter passing scheme.

This is because , assuming a pass by value semantics would require us to copy the value of the istream or ostream object which would be meaningless. In fact these objects don't even have a copy constructor at all. So such objects are always passed by reference.

You might be interested in
When you adopt a certain framework or strategy for solving a series of problems, you may fail to see other, more efficient ways
Olegator [25]
I believe it is called closed mindset. Closed mindset is when you fail to see other ways to your error and don't accept help or think you can improve.
7 0
4 years ago
Write an expression that executes the loop body as long as the user enters a non-negative number.
Grace [21]

Answer:

user_num = 9

while user_num > -1:

 print("Body")

 user_num = int(input())

print("Done")

If this answer helped consider rating and marking brainliest :)

7 0
2 years ago
Read 2 more answers
How do access the dictionary and thesaurus in Word?
horrorfan [7]
Click the FILE tab. Click Options in the list on the left side of the screen. On the WordOptions dialog box, click Proofing in the list of options on the left. 
3 0
3 years ago
Read 2 more answers
Write a program that demonstrates the skills we've learned throughout this quarter. This type of project offers only a few guide
UNO [17]

This type of project offers only a few guidelines, allowing you to invest as much time and polish as you want, as long as you meet the program requirements described below.

The code given below is tic-tac-toe

Explanation:

import java.util.Arrays;

import java.util.InputMismatchException;

import java.util.Scanner;

public class TicTacToe {

static Scanner in;

static String [ ] board;

static String turn;

public static void main(String[] args) {

 in = new Scanner(System.in);

 board = new String[9];

 turn = "X";

 String winner = null;

 populateEmptyBoard();

 System.out.println("Welcome to 2 Player Tic Tac Toe.");

 System.out.println("");

 printBoard();

 System.out.println("X's will play first. Enter a slot number to place X in:");

while (winner == null) {

  int numInput;

  try {

   numInput = in.nextInt();

   if (!(numInput > 0 && numInput <= 9)) {

    System.out.println("Invalid input; re-enter slot number:");

    continue;

   }

  } catch (InputMismatchException e) {

   System.out.println("Invalid input; re-enter slot number:");

   continue;

  }

  if (board[numInput-1].equals(String.valueOf(numInput))) {

   board[numInput-1] = turn;

   if (turn.equals("X")) {

    turn = "O";

   } else {

    turn = "X";

   }

   printBoard();

   winner = checkWinner();

  } else {

   System.out.println("Slot already taken; re-enter slot number:");

   continue;

  }

 }

 if (winner.equalsIgnoreCase("draw")) {

  System.out.println("It's a draw! Thanks for playing.");

 } else {

  System.out.println("Congratulations! " + winner + "'s have won! Thanks for playing.");

 }

}

static String checkWinner() {

 for (int a = 0; a < 8; a++) {

  String line = null;

  switch (a) {

  case 0:

   line = board[0] + board[1] + board[2];

   break;

  case 1:

   line = board[3] + board[4] + board[5];

   break;

  case 2:

   line = board[6] + board[7] + board[8];

   break;

  case 3:

   line = board[0] + board[3] + board[6];

   break;

  case 4:

   line = board[1] + board[4] + board[7];

   break;

  case 5:

   line = board[2] + board[5] + board[8];

   break;

  case 6:

   line = board[0] + board[4] + board[8];

   break;

  case 7:

   line = board[2] + board[4] + board[6];

   break;

  }

  if (line.equals("XXX")) {

   return "X";

  } else if (line.equals("OOO")) {

   return "O";

  }

 }

 for (int a = 0; a < 9; a++) {

  if (Arrays.asList(board).contains(String.valueOf(a+1))) {

   break;

  }

  else if (a == 8) return "draw";

 }

 System.out.println(turn + "'s turn; enter a slot number to place " + turn + " in:");

 return null;

}

static void printBoard() {

 System.out.println("/---|---|---\\");

 System.out.println("| " + board[0] + " | " + board[1] + " | " + board[2] + " |");

 System.out.println("|-----------|");

 System.out.println("| " + board[3] + " | " + board[4] + " | " + board[5] + " |");

 System.out.println("|-----------|");

 System.out.println("| " + board[6] + " | " + board[7] + " | " + board[8] + " |");

 System.out.println("/---|---|---\\");

}

static void populateEmptyBoard() {

 for (int a = 0; a < 9; a++) {

  board[a] = String.valueOf(a+1);

 }

}

}

5 0
3 years ago
Why would a virtual machine be useful in a school? It provides a completely secure connection to the internet. Students can coll
Stels [109]
They can learn more and also it’s faster
5 0
3 years ago
Other questions:
  • Write an expression using a variable that shows how much 3 pairs of jeans will cost if you do not know the price of the jeans.as
    7·1 answer
  • If the processor has 32 address lines in its address bus; i.e. 32-bit address range, what is its address space or range; i.e. wh
    10·1 answer
  • Write a method that determines the total number of chars in each string of an array.
    12·1 answer
  • This type of connector is the most common for connecting peripherals (printers, monitors, storage devices, etc.) to a windows co
    10·1 answer
  • Steve left his computer switched on in his room and went out to have breakfast. When he returned, he saw that the monitor had be
    9·1 answer
  • In Linux, users are internally represented using a unique number called user ID or uid.
    9·1 answer
  • Which of the following correctly describes the reason for quality customer service?
    9·1 answer
  • Please helpppppppppp​
    8·1 answer
  • A good machine should have the mechanical advantage of......?​
    7·1 answer
  • Data files whose records are always retrieved in sequence from the beginning of the file are known as
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!