Flash Speed Questions

The solution time is much shorter than you think.

#include using namespace std; void swap1(int n1, int n2) { int temp = n1; n1 = n2; n2 = temp; } void swap2(int&amp; n1, int&amp; n2) { int temp = n1; n1 = n2; n2 = temp; } void swap3(int* p1, int* p2) { int temp = *p1; *p1 = *p2; *p2 = temp; } void swap4(int* &amp;p1, int* &amp;p2) { int* temp = p1; p1 = p2; p2 = temp; } int main() { int num1 = 1; int num2 = 2; cout &lt;&lt; "before invoking the swap1 function, num1 is " &lt;&lt; num1 &lt;&lt; " and num2 is " &lt;&lt; num2 &lt;&lt; endl; swap1(num1, num2); cout &lt;&lt; "after invoking the swap1 function, num1 is " &lt;&lt; num1 &lt;&lt; " and num2 is " &lt;&lt; num2 &lt;&lt; endl; cout &lt;&lt; "before invoking the swap2 function, num1 is " &lt;&lt; num1 &lt;&lt; " and num2 is " &lt;&lt; num2 &lt;&lt; endl; swap2(num1, num2); cout &lt;&lt; "after invoking the swap2 function, num1 is " &lt;&lt; num1 &lt;&lt; " and num2 is " &lt;&lt; num2 &lt;&lt; endl; cout &lt;&lt; "before invoking the swap3 function, num1 is " &lt;&lt; num1 &lt;&lt; " and num2 is " &lt;&lt; num2 &lt;&lt; endl; swap3(&amp;num1, &amp;num2); cout &lt;&lt; "after invoking the swap3 function, num1 is " &lt;&lt; num1 &lt;&lt; " and num2 is " &lt;&lt; num2 &lt;&lt; endl; int* p1 = &amp;num1; int* p2 = &amp;num2; cout &lt;&lt; "before invoking the swap4 function, p1 is " &lt;&lt; p1 &lt;&lt; " and p2 is " &lt;&lt; p2 &lt;&lt; endl; swap4(p1, p2); cout &lt;&lt; "after invoking the swap4 function, p1 is " &lt;&lt; p1 &lt;&lt; " and p2 is " &lt;&lt; p2 &lt;&lt; endl; return 0; } Get the answer
Category: womensstudies | Author: Ehud Raghnall

## Related Questions

##### #l2 letter to the editor television and motion pictures have been dist
ecology5 Minutes ago
##### \$ which word in the sentence below is a possessive noun?iei found som
womensstudies7 Minutes ago
##### \$ where t is the number of a =500 the milligrams of aspirin in a pers
art12 Minutes ago

## art

Abraham Uilleam 55 Minutes ago

\$ \$ the circle graph below shows the percent of students in jim's class that prefer each sport. baseball: 30% basketball: 15% soccer: 10% x football:

## literature

Giiwedin Frigyes 1 Hours ago

\$ 20,000 is invested at a rate of 5% compounded quarterly. identify the compound interest function ta model the situation. then find the balance after

## science

Giiwedin Frigyes 1 Hours ago

\$ = {even numbers above 20 and less than 50} a = {26, 30, 32, 44, 48}b = {22, 26, 34}a) complete the venn diagram to show information. a number is ch