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
Lera25 [3.4K]
3 years ago
13

Assume that ip , jp , and tp have all been declared to be pointers to int and that result has been declared to be an array of 10

0 elements . Assume further that ip has been initialized to point to an element in the first half of the array and that jp has been initialized to point to an element in the second half of the array .Write some code that makes jp point to the element that ip was pointing to and that makes ip point to the element that jp was pointing to.Instructor Notes: Here, you are swapping the pointers, not the values they point to.
Computers and Technology
1 answer:
natita [175]3 years ago
3 0

Answer:

The code to this question can be given as:

code:

tp = ip;

ip = jp;

jp = tp;

Explanation:

In this question, it is defined that write code for swapping values that swap the pointers, not the values they point to. So in this code, we assume that all the variable and its value is defined. we simply use the swapping rule that is the first value holds in the new variable and second value hold on the first variable and in the last second variable holds the value of the new variable. In this code, the value will be interchanged or swapped.

You might be interested in
Where to set up wireless network xbox one?
svlad2 [7]
Turn on your Xbox One and go to the Settings menu.

Select Network.

Select Set Up wireless network, to connect to a new network.

Xbox One asks Which one is yours? and displays the wireless networks it detects in your area.

Select the network you want to connect to.

4 0
3 years ago
Which of the following is a valid HTML reference to a CSS file?
arsen [322]

Answer:

C

Explanation:

<link rel="stylesheet" type="text/css" href="syb/syb.css" title="stylesheet"/>

The above code is self explanatory. All others have wrong rel or title. Title is always stylesheet, and rel as well stylesheet as well as href is external css file which we are loading, and text/css is always the type as it is the css. None of the other has this syntax. And hence this is the right answer.

5 0
3 years ago
Write a statement that increments numUsers if updateDirection is 1, otherwise decrements numUsers. Ex: if numUsers is 8 and upda
Lady_Fox [76]

Answer:

Following are the statement is given below

if(updateDirection ==1) // check condition

{

++numUsers; // increments the value

}

else

{

--numUsers; // decrement the value

}

Explanation:

Following are the description of statement

  • Check the condition in the if block .If the "updateDirection" variable is 1 then then control moves to the if block otherwise control moves to the else block statement.
  • In the if  block the statement is "++numUsers" it means it increment the value by 1 .
  • In the else block the statement is "--numUsers" it means it decrement  the value by 1 .

4 0
3 years ago
Read the following code carefully and do as directed: int main() { // Initialising starting number int num = 1; int n=7 // Outer
Wittaler [7]

Answer:

81

Explanation:

12734

4 0
3 years ago
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have me
RSB [31]

Answer:

Explanation:

The code provided worked for the most part, it had some gramatical errors in when printing out the information as well as repeated values. I fixed and reorganized the printed information so that it is well formatted. The only thing that was missing from the code was the input validation to make sure that no negative values were passed. I added this within the getMonths() method so that it repeats the question until the user inputs a valid value. The program was tested and the output can be seen in the attached image below.

import java.io.*;

import java.util.*;

class Rainfall

{

   Scanner in = new Scanner(System.in);

   private int month = 12;

   private double total = 0;

   private double average;

   private double standard_deviation;

   private double largest;

   private double smallest;

   private double months[];

   public Rainfall()

   {

       months = new double[12];

   }

   public void setMonths()

   {

       for(int n=1; n <= month; n++)

       {

           int answer = 0;

           while (true) {

               System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );

               answer = in.nextInt();

               if (answer > 0) {

                   months[n-1] = answer;

                   break;

               }

           }

       }

   }

   public void getTotal()

   {

       total = 0;

       for(int i = 0; i < 12; i++)

       {

           total = total + months[i];

       }

       System.out.println("The total rainfall for the year is " + total);

   }

   public void getAverage()

   {

       average = total/12;

       System.out.println("The average monthly rainfall is " + average);

   }

   public void getLargest()

   {

       double largest = 0;

       int largeind = 0;

       for(int i = 0; i < 12; i++)

       {

           if (months[i] > largest)

           {

               largest = months[i];

               largeind = i;

           }

       }

       System.out.println("The largest amount of rainfall was " + largest +

               " inches in month " + (largeind + 1));

   }

   public void getSmallest()

   {

       double smallest = Double.MAX_VALUE;

       int smallind = 0;

       for(int n = 0; n < month; n++)

       {

           if (months[n] < smallest)

           {

               smallest = months[n];

               smallind = n;

           }

       }

       System.out.println("The smallest amount of rainfall was " + smallest +

               " inches in month " + (smallind + 1));

   }

   public static void main(String[] args)

   {

       Rainfall r = new Rainfall();

       r.setMonths();

       r.getTotal();

       r.getSmallest();

       r.getLargest();

       r.getAverage();

   }

}

8 0
2 years ago
Other questions:
  • The ____ is a new feature in versions of microsoft office, starting with office 2007; it consists of tabs, which contain groups
    5·1 answer
  • You have a network of 300 users. You are finding that you must frequently restore files from backup that users have accidentally
    13·1 answer
  • write a program using if condition and print fail and try again if student marks are less than 33 using if condition and print f
    5·1 answer
  • ____ is a special type of large, integrated system that ties together all types of a company’s activities, such as planning, man
    11·2 answers
  • When you press the ____ key without entering any text after the automatic bullet character, Word turns off the automatic bullets
    11·1 answer
  • What is the function of a breadcrumb trail in a website?
    13·1 answer
  • What is the output of the following JavaScript code?
    9·1 answer
  • What explains the discrepancy between the number of bytes you can
    13·1 answer
  • Are you absent minded because you are thinking of an online activity?​
    12·1 answer
  • Unscramble the given word and identify the correct statement about it. ATTEPLSR
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!