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
dedylja [7]
3 years ago
11

Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 38 then the outpu

t is: 83 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues (int* userVali, int* userVal2) LAB ACTIVITY 6.22.1: LAB: Swapping variables 22.1. LAB 0/10 ] main.c Load default template... #include /* Define your function here */ int main(void) { Ovo AWN /* Type your code here. Your code must call the function. */ return 0; 10 }
Computers and Technology
1 answer:
Likurg_2 [28]3 years ago
6 0

Answer:

Following are the program in the C++ Programming Language.

#include <iostream>

using namespace std;

//define function for swapping

void SwapValues(int* userVal1,int* userVal2){  

//set integer variable to store the value

int z = *userVal1;

//interchange their value

*userVal1 = *userVal2;  

//interchange their value

*userVal2 = z;

}

//define main method

int main()

{    

//declare variables

int x,y;

//get input from the user

cin>>x>>y;

//Call the method to swap the values

SwapValues(&x,&y);

//print their values

cout<<x<<" "<<y;

return 0;

}

<u>Output</u>:

3 8

8 3

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, we define required header file and function 'SwapValues()', pass two pointer type integer variables in argument that is 'userVal1' and 'userVal2'.
  • Set integer data type variable 'z' and initialize the value of 'userVal1' in it, then initialize the value of 'userVal2' in 'userVal1' and then initialize the value of 'z' in 'userVal2'.
  • Finally, define the main method in which we set two integer type variables and get input from the user in it then, call and pass those variables and print it.
You might be interested in
Technician A says that the reserve rating of a battery is the amount of steady current that a fully charged battery can supply f
Andre45 [30]

Answer:

Neither A nor B

Explanation:

<em>Reserve capacity</em> is the number of minutes that a new, fully charged battery can discharge continuously and maintain a terminal voltage equal to or greater than 1.75 volts per cell.

<em>An ampere-hour </em>is an electric charge unit and its abbreviation is Ah.

It measures the amount of electric charge flowing through a battery in the case that amount supplies a current of 1 amp for 1 hour.

5 0
2 years ago
Write a method reverse that takes an array as an argument and returns a new array with the elements in reversed order. Do not mo
mr Goodwill [35]

Answer:

public class ArrayUtils

{

//function to reverse the elements in given array

public static void reverse(String words[])

{

//find the length of the array

int n = words.length;

//iterate over the array up to the half

for(int i = 0;i < (int)(n/2);i++)

{

//swap the first element with last element and second element with second last element and so on.

String temp;

temp = words[i];

words[i] = words[n - i -1];

words[n - i - 1] = temp;

}

}

public static void main(String args[])

{

//create and array

String words[] = {"Apple", "Grapes", "Oranges", "Mangoes"};

//print the contents of the array

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

{

System.out.println(words[i]);

}

//call the function to reverse th array

reverse(words);

//print the contents after reversing

System.out.println("After reversing............");

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

{

System.out.println(words[i]);

}

}

Explanation:

4 0
2 years ago
For each policy statement, select the best control to ensure Ken 7 Windows Limited fulfills the stated requirements and also pro
elena-14-01-66 [18.8K]

Answer:

1. Option (a) is the correct answer. "Place a firewall between the Internet  and your Web server".

2.  Option (e) is the correct answer. "Require encryption for all traffic flowing into and out from the Ken 7 Windows environment".

3. Option (d) is the correct answer. "Implement Kerberos authentication for all internal servers".

4. The correct answer is option (g) "Require all personnel attend a lunch and learn session on updated network security policies".

5. Option (c) is the correct answer. "Enforce password complexity".

Explanation:

1. Users who tried to use ken 7 network resources for social media access will not be enable to do so.

2. Encryption for inflow and outflow of traffic from Ken 7 windows environment will monitor any personal devices which is connected to Ken 7 windows network.

3. The implementation of Kerberos authentication will deny anonymous users access to protected resources in Ken 7 infrastructure.

4.All personnel will be taught the network policies  to avoid sending report to unsecured printers.

5.  The more complex passwords are, the more secured the server will be. A complex password should be enforce for network security.

8 0
3 years ago
This function receives first_name and last_name, then prints a formatted string of "Name: last_name, first_name" if both names a
pishuonlain [190]

Answer:

Following are the program in the C++ Programming Language.

//set header file

#include <iostream>

//set namespace

using namespace std;

//define class

class format

{

//set access modifier

public:

//set string type variable

 string res;

//define function

 void names(string first_name, string last_name)

 {  

//set if-else if condition to check following conditions

   if(first_name.length()>0 && last_name.length()>0)

   {

     res="Name: "+last_name+", "+first_name;

   }

   else if(first_name.length()>0 and last_name.length()==0)

   {

     res="Name: "+first_name;

   }

   else if(first_name.length()==0 and last_name.length()==0)

   {

     res="";

   }

 }

//define function to print result

 void out(){

   cout<<res<<endl;

 }

};

//define main method

int main() {

//set objects of the class

 format ob,ob1,ob2;

//call functions through 1st object

 ob.names("John","Morris");

 ob.out();

//call functions through 2nd object

 ob1.names("Jhon","");

 ob1.out();

//call functions through 3rd object

 ob2.names("", "");

 ob2.out();

}

<u>Output</u>:

Name: Morris, John

Name: Jhon

Explanation:

<u>Following are the description of the program</u>:

  • Define class "format" and inside the class we define two void data type function.
  1. Define void data type function "names()" and pass two string data type arguments in its parameter "first_name" and "last_name" then, set the if-else conditional statement to check that if the variable 'first_name' is greater than 0 and 'last_name' is also greater than 0 then, the string "Name" and the following variables added to the variable "res". Then, set else if to check that if the variable 'first_name' is greater than 0 and 'last_name' is equal to 0 then, the string "Name" and the following variable "first_name" added to the variable "res".
  2. Define void data type function "out()" to print the results of the variable "res".
  • Finally, we define main method to pass values and call that functions.
3 0
3 years ago
Evaluate the arithmetic expression 234 + 567​
Anton [14]

Answer:

801

Explanation:

234 + 567 = 801

6 0
2 years ago
Other questions:
  • The number of bits used to store color information about each pixel is called ____.
    13·1 answer
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • You order a new personal computer. A representative from the store calls to ask if you need CD-copying software in your personal
    12·1 answer
  • Which is said to be ‘computer on a chip’
    8·1 answer
  • A two-dimensional array of characters can contain Group of answer choices
    11·1 answer
  • The first step to accurate coding is to identify the ___________ in the diagnostic statement.
    7·1 answer
  • what are the benefits of VolP? select all that apply. A:cheaper printings B:clearer calls C: faster download D: increased effici
    11·2 answers
  • The Brinley website will not let me search for questions anymore. It says “Search all you want in-app” and then covers the quest
    14·1 answer
  • Create a query that shows columns employee last name, job title and hire date for those employees who joined the company on or a
    7·1 answer
  • Which of the following is not a method for opening Word software?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!