In C Please thanks Write a program that prompts users for th

In C++ Please. thanks.

Write a program that prompts users for the name and number of points of two basketball teams. Then, it uses a nested if to display the winner (if any) or a message stating a tie if both teams have the same number of points - One screen shot per scenario - use one function to determine the possible scenarios.

Solution

#include <iostream>
using namespace std;
void compare (char a[],char b[], float x, float y);
int main()
{
    char t1[100],t2[100];
    float p1,p2;
    cout << \"Enter a First Team Name: \";
    cin >> t1;
    cout << \"Enter First Team Points :\";
    cin >> p1;
    cout << \"Enter a Second Team Name: \";
    cin >> t2;
    cout << \"Enter Second Team Points :\";
    cin >> p2;

    compare (t1,t2,p1,p2);   //calling function

}
void compare (char a[], char b[], float x, float y)   //defining function
{
   if (x!=y)
    {
       if (x>y)
           cout << \"\" Winner Team is : \" << a << \"with points \" << x;
       else
           cout << \"\" Winner Team is : \" << b << \"with points \" << y;
   }
   else
       cout << \"There is a tie between two team for similar points.\"
}

In C++ Please. thanks. Write a program that prompts users for the name and number of points of two basketball teams. Then, it uses a nested if to display the wi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site