Answer to Question #24383 in C++ for Nour

Question #24383
Suppose I have a struct called Player that has fields called points, assists, and rebounds. Write a function called All Star if points exceeds 20, assists exceeds 8, and rebounds exceeds 5.
1
Expert's answer
2013-02-18T12:13:32-0500
#include <cmath>
#include <conio.h>
#include <iostream>

using namespace std;

struct Player
{
int points;
int assists;
int rebounds;
};

bool AllStar(Player& player)
{
if (player.points > 20 && player.assists > 8 && player.rebounds > 5)
return true;
return false;
}

int main()
{
Player player = {19, 13, 6};
cout << AllStar(player) << endl;
player = Player {55, 9, 12};
cout << AllStar(player) << endl;

_getch();
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
APPROVED BY CLIENTS