Please ,could you explain this sentence

The wins should be input in a parameter-less value returning function that returns the wins to the main function

returning function just returns value and does not print message , right ?

#include<iostream>
using namespace std;



int wins(int wins)
{
    cout<<"Please input the number of wins"<<endl;
    cin>>wins;
    return  wins ;
}

int losses(int losses)
{
    cout<<"Please input the number of losses"<<endl;
    cin>>losses;
    return losses;
}

int main()
{
    how?

}

Recommended Answers

All 7 Replies

I interpret it as meaning that the function used to get the wins should be a parameter-less function, which means it takes in no parameters.

int wins()
{
    int value;
    cout << "Please input the number of wins" << endl;
    cin >> value;
    return value;
}

i should get this output:
Click Here

i changed the codes but i do not what I'm doing right or not?

to make you understand the problem , this is the problem:

The wins should be input in a parameter-less value returning function that returns the wins to the main function. A similar function should do the same thing for the losses. A third value returning function calculates the percentage of wins. It receives the wins and losses as parameters and returns the percentage (float) to maim program.

 #include<iostream>
    #include<iomanip>
    using namespace std;
    int wins()
    {
        return 80 ;
    }

    int losses()
    {
        return 40;
    }

    float percentage(int x, int y)
    {
        float percentage;
        int a= wins();
        int b= losses();
        int c= a+b;
        percentage= (a/c)*100;

        return percentage;
    }

    int main()
    {
        int x,y;
        cout<<"Please input the number of wins"<<endl;
        cout<<wins()<<endl;
        cout<<"Please input the number of losses"<<endl;
        cout<<losses()<<endl;
        cout<<setprecision(2);
        cout<<"The percentage of wins is "<<  <<" %"<<endl;// I do not know how i call percentage function?
    }

How to call a function: http://www.cplusplus.com/doc/tutorial/functions/

If how to call a function is new to you, you need to go back to wherever you started learning from and start again.

I understand perfectly. I'm just not going to do your homework for you.

this is not a homework !
I am studing for the final exam!
and i want to know if my steps in solving are correct

anyway thanks for your replaying

If this is study for the final exam, and you still do not know how to call a function, you're in big trouble.

i know how to call a function brother

you do not understand my question

my steps in solving the problem ,Is it correct or not

 #include<iostream>
 #include<iomanip>
 using namespace std;

 int wins()
    {
      return 80 ;
    }

  int losses()
    {
      return 40;
    }

   float percentage()
   {
     float percentage;
     int a= wins();
     int b= losses();
     int c= a+b;
     percentage= (a/c)*100;
     return percentage;
    }

   int main()
   {

  cout<<"Please input the number of wins"<<endl;
   cout<<wins()<<endl;
   cout<<"Please input the number of losses"<<endl;
   cout<<losses()<<endl;

   cout<<setprecision(2);
   cout<<"The percentage of wins is "<<percentage()<<" %"<<endl;// I do not know how i call percentage function?
   }

i solved the problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.