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
stepan [7]
2 years ago
7

Create a Delegate to Compare two Integers.

Computers and Technology
1 answer:
Yanka [14]2 years ago
6 0

Answer:

Delegate is a function pointer which points the address of a function.

Explanation:

Let the function to compare two integers takes two integers as arguments

C#.net syntax:

delegate void  Del(int,int);

Here delegate is the keyword. Del is the name of the delegate which stores the address of the function whose return type is void and which takes 2 integer arguments.

public void CompareIntegers(int x, int y)

{

if (x>y) Console.WriteLine("X is greater");

else Console.WriteLine("Y is greater");

}

delegate void  Del(int,int);

void main(){

Del del1=new Del(CompareIntegers);

}

You might be interested in
Consider two different implementations, M1 and M2, of the same instruction set. There are three classes of instructions (A, B, a
Margaret [11]

Explanation:

A.)

we have two machines M1 and M2

cpi stands for clocks per instruction.

to get cpi for machine 1:

= we multiply frequencies with their corresponding M1 cycles and add everything up

50/100 x 1 = 0.5

20/100 x 2 = 0.4

30/100 x 3 = 0.9

CPI for M1 = 0.5 + 0.4 + 0.9 = 1.8

We find CPI for machine 2

we use the same formula we used for 1 above

50/100 x 2 = 1

20/100 x 3 = 0.6

30/100 x 4 = 1.2

CPI for m2 =  1 + 0.6 + 1.2 = 2.8

B.)

CPU execution time for m1 and m2

this is calculated by using the formula;

I * CPI/clock cycle time

execution time for A:

= I * 1.8/60X10⁶

= I x 30 nsec

execution time b:

I x 2.8/80x10⁶

= I x 35 nsec

6 0
2 years ago
Write a program which asks the user to enter N numbers. The program will print out their average. Try your program with the foll
Likurg_2 [28]

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

int n;

double average,sum=0,x;

cout<<"enter the Value of N:";

// read the value of N

cin>>n;

cout<<"enter "<<n<<" Numbers:";

// read n Numbers

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

{

   cin>>x;

   // calculate total sum of all numbers

   sum=sum+x;

}

// calculate average

average=sum/n;

// print average

cout<<"average of "<<n<<" Numbers is: "<<average<<endl;

return 0;

}

Explanation:

Read the total number from user i.e "n".Then read "n" numbers from user with for loop and sum them all.Find there average by dividing the sum with n.And print the average.

Output:

enter the Value of N:5

enter 5 Numbers:20.5 19.7 21.3 18.6 22.1

average of 5 Numbers is: 20.44

7 0
3 years ago
You want to connect the LAN port on a router to the uplink port on a switch. The switch does not support auto-MDI. Which type of
kirza4 [7]

Answer: Crossover

Explanation:

Based on the information given in the question, the type of cable that should be used is the crossover cable.

Crossover cable is used for a direct connection of computing devices. A crossover cable is typically used for the connection of computing devices that are of identical types.

Since the LAN port on a router is to be connected to the uplink port on a switch and the switch does not support auto-MDI, the crossover cable can be used.

3 0
2 years ago
You are studying at the library and someone at your table has some great study material. both of you have an ipad with you. you
myrzilka [38]
C.apple domain is to use the personal sharing files from one computer to another computer
3 0
3 years ago
Which aspect of design theory describes the relationship of one object to another in size? A.value B.form C.proportion D.tecture
pashok25 [27]

Answer:

<u>Proportion </u>is the aspect in design theory that describe the relationship of one object to another object in size.

Explanation:

Proportion is an important aspect in design theory in terms of size. It refers to the relationship between object of the design in terms of size. The relation between size of different object in design theory can describe as, if the size of one object increases or decreases, it may leads to change in size of other object. It is called proportion.

If the size of one object increase with the size of other object, the relation is called direct proportion. If the size of one object decrease with the increase in size of other object is called inverse proportion.

7 0
3 years ago
Other questions:
  • A group of interrelated resources acting together according to a plan to accomplish the goals of the records and information man
    5·1 answer
  • Describe the dynamic Network Address Translation (NAT).
    9·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • An elevator of mass 250kg is carrying two persons whose masses are 50kg and 100kg. if the force exerted by the motor is 3000N. C
    12·1 answer
  • 6. Python indexes lists beginning with the number 1.<br> True<br><br> False
    15·1 answer
  • Write a C++ Programm in which inheritance is used
    7·1 answer
  • <img src="https://tex.z-dn.net/?f=%28a%20%2B%20b%29%20%20%7B2%7D" id="TexFormula1" title="(a + b) {2}" alt="(a + b) {2}" align
    15·1 answer
  • Assume in the for loop header, the range function has the three arguments: range (1, 10, 3), if you were to print out the value
    6·1 answer
  • When it comes to credit scores, why is having a
    9·1 answer
  • Python Programming
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!