Write two functions that take reference parameters: read lnput this function tak
ID: 3656013 • Letter: W
Question
Write two functions that take reference parameters: read lnput this function takes two integers as parameters the function will ask the user for two integers and read them into the reference parameters the function does not return any value Sort This function takes two integers as parameters, say a and b, and sort them After the function a will contain the smaller number and b will contain the bigger number The function does not return any value In your main() function, you need to make calls to the above two functions as follows: int main() { int a, b; read lnput(a, b); sort(a, b); coutExplanation / Answer
#include using namespace std; void readInput(int& a,int& b) { couta; coutb; } void sort(int& a,int& b) { if(a>b) { int temp = a; a = b; b = temp; } } int main() { int a,b; readInput(a,b); sort(a,b); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.