Answer to Question #142589 in C++ for ali

Question #142589
Write a statement that increases numPeople by 5. Ex: If numPeople is initially 10, the output is: There are 15 people.
1
Expert's answer
2020-11-05T04:12:23-0500
#include <iostream>

int incFive(int nP) {
	return nP += 5;
}

int main()
{
	int numPeople;
	std::cout << "Please enter the number of people : ";
	std::cin >> numPeople;
    std::cout << "There are " << incFive(numPeople) << " people.\n";
}

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