Answer to Question #145346 in C++ for Jaya

Question #145346
Write an if-else statement that if userTickets is greater than 5, executes awardPoints = 15. Else, execute awardPoints = userTickets. Ex: If userTickets is 14, then awardPoints = 15.
1
Expert's answer
2020-11-19T08:31:04-0500
#include <iostream>
using namespace std;

int main() {
	int userTickets, awardPoints;
	cout << "Enter user tickets: ";
	cin >> userTickets;
	
	if (userTickets > 5)
	{
		awardPoints = 15;
	}
	else
	{
		awardPoints = userTickets;
	}
	cout << "Award points: " << awardPoints;
	return 0;
}


Also please check what type of indentation you should use:

if (statement)
	body;

or

if (statement) {
	body;
}

or

if (statement)
{
	body;
}

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