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]
2 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]2 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
What is one reason why a business may want to move entirely online?
andrezito [222]

Answer:

To focus on global market

Explanation:

Hope this helps! :)

3 0
2 years ago
Write a program that prints the Grade based on the given data. 95-100: A+ 90-94: A 80-89: B+ 70-79: B 60-69: C+ 50-59: C &lt;49
mr Goodwill [35]

Answer:

The program to this question as follows:

Program:

score=int(input("Enter your percentage: ")) #input grade by user

#using conditional statement for match condition  

if 95<=score <= 100: #if value in between 95 to 100

   grade = 'A+' #assign grade

elif 90 <=score <= 94: #elif value in between 90 to 94

   grade = 'A' #assign grade

elif 80 <=score <= 89:  #elif value in between 80 to 89

   grade = 'B+' #assign grade

elif 70 <=score <= 79:  #elif value in between 70 to 79

   grade = 'B' #assign grade

elif 60 <=score <= 69:  #elif value in between 60 to 69

   grade = 'C+' #assign grade

elif 50 <=score <= 59:  #elif value in between 50 to 59

   grade = 'C' #assign grade

elif score<49 :  #elif value is less then 49

   grade = 'F' #assign grade

print (grade) #print grade

Output:

Enter your percentage: 50

C

 Explanation:

In the above python code, a variable "score" is defined, this variable is used for taking value from the user end. In the next step if-elif-else conditional statement is used, this statement is used when a group of statements is given in which one is true. The if block check score value is between 95-100 if this is true it will print A+.

In elif block if the above condition is not true, then this condition will execute, in this block, there are multiple elif block is used that can be described as follows:

  • In the first block, if the value in between 90-94. It will print A.
  • In the second block, if the value in between 80-89. It will print B+.
  • In the third block, if value in between 70-79. It will print B.
  • In the fourth block, if value in between 60-69. It will print C+.
  • In the fifth block, if value in between 50-59. It will print C.
  • In the last, if the value of the score is less then 49. It will print F.
8 0
2 years ago
Your program Assignment Write a program that reads a sentence as input and converts each word to "Pig Latin". In one version of
xxTIMURxx [149]

Answer:

theSentence = input('Enter sentence: ')

theSentence = theSentence.split()

sentence_split_list =[]

for word in theSentence:

  sentence_split_list.append(word[1:]+word[0]+'ay')

sentence_split_list = ' '.join(sentence_split_list)

print(sentence_split_list)

Explanation:

Using the input function in python Programming language, the user is prompted to enter a sentence. The sentence is splited and and a new list is created with this statements;

theSentence = theSentence.split()

sentence_split_list =[ ]

In this way every word in the sentence becomes an element in this list and individual operations can be carried out on them

Using the append method and list slicing in the for loop, every word in the sentence is converted to a PIG LATIN

The attached screenshot shows the code and output.

5 0
2 years ago
Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e.g. words[1] = words[2]) and a temporar
Svetlanka [38]

Answer:

words = ['is', 'NLP', 'fun', '?']

tmp = words[1]

words[1] = words[0]

words[0] = tmp

words[3] = '!'

print(words)

Explanation:

- Create the list

- Assign the new values using <em>tmp</em> variable

- Print the result

Since tuples in Python are unchangeable, you cannot transform the list using tuple assignment.

5 0
2 years ago
Question 7<br> What is the description of The Ribbon?
Aloiza [94]

Answer:

a flat or tubular narrow closely woven fabric (as of silk or rayon) used for trimmings or knitting. b : a narrow fabric used for tying packages. c : a piece of usually multicolored ribbon worn as a military decoration or in place of a medal. d : a strip of colored satin given for winning a place in a competition

7 0
2 years ago
Other questions:
  • The network ____, the person overseeing network operations, uses a server operating system to add and remove users, computers, a
    15·1 answer
  • Five computers are connected to a switch in a star topology. what type of network is this?
    12·1 answer
  • How can a network design project benefit from the principles of itsm? How might itsm impede a network design project?
    11·1 answer
  • Which director has shot a movie in HD? George Lucas, Michael Mann, Michael Moore, none of the above, all of the above
    14·1 answer
  • Write a program that displays the following menu:
    8·1 answer
  • Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimete
    7·1 answer
  • The minimum spanning tree of an undirected graph G exists if and only if G is connected. True or False?
    12·1 answer
  • Make a list of five primary raw materials, for each one, indicate and industrial material that is created from it
    10·2 answers
  • If you have limited means, you...?
    9·1 answer
  • Location of a video or photoshoot is not important when it comes to preplanning the shoot.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!