Answer to Question #343748 in C++ for Sach

Question #343748

Use three functions to perform the following tasks:


- Accept two integers from user. A function capture should do this using its


local variables fnum and snum.


- Modify the contents by multiplying the original values by 10. The function


modify should modify the values of fnum and snum as stated.


- Display the new value to the user. The function display should print to the


user the new values of fnum and snum variables.



1
Expert's answer
2022-05-22T18:09:36-0400
#include <iostream>


void capture(int& fnum, int& snum)
{
	std::cout << "Please enter fnum: ";
	std::cin >> fnum;
	std::cout << "Please enter snum: ";
	std::cin >> snum;
}

void modify(int& fnum, int& snum)
{
	fnum *= 10;
	snum *= 10;
}

void display(int fnum, int snum)
{
	std::cout << "New value fnum=" << fnum << std::endl;
	std::cout << "New value snum=" << snum << std::endl;
}

int main()
{
	int fnum, snum;
	capture(fnum, snum);
	modify(fnum, snum);
	display(fnum, snum);

	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS