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
yuradex [85]
3 years ago
7

Assuming that t is an array and tPtr is a pointer to that array, which expression refers to the address of element 3 of the arra

y?
Computers and Technology
1 answer:
stealth61 [152]3 years ago
7 0
<span>According to the basics of C++ syntax, &t[ 3 ] refers to the address of element 3 of the array given above. The array can be imagined like a box with some stuff. This stuff is the numbers which should be in "[ ... ]" with name of the array written before and "&".</span>
You might be interested in
Tortise and hare race java g Modify the main class so it runs the race 100 times and reports how many times each runner wins. (T
SOVA2 [1]

Answer:

Game.java file

import java.util.Scanner;

public class Game {

/**

* t_pos and h_pos are the current positions of the Tortoise and Hare

*/

static int t_pos,h_pos;

static Tortoise tortoise;

static Hare hare;

public static void main(String[] args) {

play(); /*starting the game*/

}

public static void play(){

/**

* the method will starts the play, loop until the game is over, displays the winner

* and prompts the user if they want to play again

*/

/**

* defining Tortoise and Hare objects

*/

tortoise=new Tortoise();

hare=new Hare();

t_pos=1;

h_pos=1;

System.out.println("The race is about to start");

tortoise.printTrack();

hare.printTrack();

while(t_pos != 50 && h_pos !=50){

System.out.println("\n\n\n"); /*printing blank lines*/

t_pos=tortoise.move(); /*moving and getting the current position of tortoise*/

h_pos=hare.move();/*moving and getting the current position of hare*/

tortoise.printTrack(); /*displaying the tracks*/

hare.printTrack();

try { /*comment this part to skip the 1s break between each round; for testing*/

Thread.sleep(1000);

} catch (InterruptedException e) {

e.printStackTrace();

}

}

System.out.println("\nRace Over");

if(t_pos==50 && h_pos==50){

System.out.println("Its a tie");

}

else if(t_pos==50){

System.out.println("Tortoise wins");

}else if(h_pos==50){

System.out.println("Hare wins");

}

System.out.println("Do you want to play again? (y/n)");

Scanner scanner=new Scanner(System.in);

String ch=scanner.next();

if(ch.equalsIgnoreCase("y")){

play();

}else if(ch.equalsIgnoreCase("n")){

System.out.println("Thanks for playing, Goodbye");

}else{

System.out.println("Invalid choice, quitting..");

}

}

}

//Tortoise.java

public class Tortoise {

/**

* the current position of the tortoise

*/

int position;

/**

* track array

*/

char[] track;

/**

* speed of tortoise

*/

int speed=1;

public Tortoise() {

position=0;

track=new char[50];

for(int i=0;i<track.length;i++){

/**

* filling the track

*/

track[i]='-';

}

}

public int move(){

if(position<track.length){

position=position+speed;

}

return position+1;

}

public void printTrack(){

/**

* the current position of tortoise will be displayed by 'T' everything else will be '-'

*/

System.out.println();

for(int i=0;i<track.length;i++){

if(i==position){

System.out.print('T');

}else{

System.out.print(track[i]);

}

}

}

}

//Hare.java

import java.util.Random;

public class Hare {

int position;

int speed=10;

char[] track;

/**

* Random object to generate a random number

*/

Random random;

/**

* resting percent denotes how much time Hare will be resting

*/

int resting_percent=90;

public Hare() {

position=0;

track=new char[50];

for(int i=0;i<track.length;i++){

track[i]='-';

}

random=new Random();

}

public int move(){

int n=random.nextInt(100-1)+1; /*generating a random number between 1 and 100*/

if(n<=resting_percent){

/**

* at rest; will not move, returns the current position.

*/

return position;

}else{

/**

* not resting..

*/

if(position<track.length){

if(position+speed>=track.length){

position=track.length-1;

}else{

position=position+speed;

}

}

return position+1;

}

}

public void printTrack(){

System.out.println();

for(int i=0;i<track.length;i++){

if(i==position){

System.out.print('H');

}else{

System.out.print(track[i]);

}

}

}

}

/*Output (partial and random)*/

The race is about to start

T-------------------------------------------------

H-------------------------------------------------

-T------------------------------------------------

H-------------------------------------------------

--T-----------------------------------------------

H-------------------------------------------------

---T----------------------------------------------

----------H---------------------------------------

.

.

.

.

-----------------------------------------------T--

-------------------------------------------------H

Race Over

Hare wins

Do you want to play again? (y/n)

y

The race is about to start

T-------------------------------------------------

H-------------------------------------------------

-T------------------------------------------------

H-------------------------------------------------

.

.

.

.

-----------------------------------------------T--

--------------------H-----------------------------

------------------------------------------------T-

--------------------H-----------------------------

-------------------------------------------------T

--------------------H-----------------------------

Race Over

Tortoise wins

Do you want to play again? (y/n)

n

Explanation:

3 0
3 years ago
Describe network in terms of the class computer lab
kobusy [5.1K]
<span>a group or system of interconnected people or things</span>
6 0
3 years ago
Precautionary measures to be observed when using ICT tools​
Dafna11 [192]

Answer:

ICT is the abbreviated form of Information and Communication. It included different technologies like mobile phones, computers, USBs etc.

Following are two precautionary measures which should be observed when using any kind of ICT:

  1. Use of Antivirus: It can used to protect anything placed inside the technology especially from hacking and viruses which can create many issues.
  2. Backup Data: Creating a backup of the data stored in the device is important as it can be recalled when the device malfunctions. Backup of the data can be created through using USBs, CDs etc or through cloud storage
7 0
3 years ago
Clifford created a table using OpenOffice Writer and entered some information into the table. Later, he needed to add more rows
Minchanka [31]

Right click the cell, click add cells & it should say the options (new row above etc.)

4 0
3 years ago
Read 2 more answers
Which of the following is a domestic business activity?
harkovskaia [24]
What are the options?

7 0
3 years ago
Read 2 more answers
Other questions:
  • You are reluctant to write an extra credit book report because you are afraid that your language and punctuation skills are not
    11·1 answer
  • Which software product release category is "generally feature complete and supposedly bug free, and ready for use by the communi
    7·1 answer
  • Write a method for the Customer class that that will return a string representing a bill notice when passed a double value repre
    14·1 answer
  • Software for creating animations
    15·2 answers
  • Indicate whether the statement is true or false. ____ 1. Autoglobal array elements are referred to with an index number. ____ 2.
    9·1 answer
  • What is boolean rules​
    12·1 answer
  • Mention 3 components that can be found at the back and front of the system unit​
    6·1 answer
  • JAVA NEED HELP ASAP
    7·1 answer
  • Write a method named addCommas that accepts a string representing a number and returns a new string with a comma at every third
    10·1 answer
  • 16. A/An __________ is operated on the principle that the dying have special needs and wants that hospital personnel are too bus
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!