void Batsman::readData6( int rns,int inn,int ntOut )
{
runs=rns;
innings=inn;
notOut=ntOut;
float calAvg(int runs, int innings , int notOut )
{
batAvg=runs/(innings-notOut);
return batAvg;
}
}
// Main function for the program
main( )
{
Batsman az;
string bCd;
string nme;
int inns;
int runss;
int NtO;
cout<<"\n Enter Batsman Bcode \n";
cin>>bCd;
cout<<"\n Enter Batsman Name \n";
cin>>nme;
cout<<"\n Enter his number of innings \n";
cin>>inns;
cout<<"\n Enter number of not-outs \n througout his innings \n";
cin>>NtO;
cout<<"\n Enter number of runs he makes \n in his inning or innings \n";
cin>>runss;
az.readData1(bCd);
az.readData2(nme);
az.readData3(inns);
az.readData4(NtO);
az.readData5(runss);
az.readData6(runss,inns,NtO);
cout<<"\n Batsman Bcode \n ="<<az.displayData1();
cout<<"\n Batsman Name \n ="<<az.displayData2();
cout<<"\n Batsman Innings \n ="<<az.displayData3();
cout<<"\n Batsman Not-outs \n ="<<az.displayData4();
Line 31: You declare that calAvg takes 3 arguments.
Line 86: You call calAvg with no arguments.
Line 21: You declare readData6 takes one argument.
Line 89: Your implementation of readData6 takes 3 arguments.
Line 104: main() must be type int.
Line 3: The correct header is <string>, not <string.h>. <string.h is the C header, not C++.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
//Now the program is running but can,t get my average .
//Please correct this code .
#include <iostream>
#include<stdlib.h>
#include<conio.h>
#include<string>
using namespace std;
class Batsman
{
public:
void readData1( string code );
string displayData1( void );
void readData2( string name );
string displayData2( void );
void readData3( int inn );
int displayData3( void );
void readData4( int ntOut );
int displayData4( void );
void readData5( int rns);
int displayData5( void );
void readData6(int rs1,int is1,int nt1);
float displayData6(void);
private:
string bCode;
string bName;
int innings;
int notOut;
int runs;
float batAvg;
float calcAvg(int rs,int is,int nt)
{
float avg= rs/(is-nt);
return avg;
}
};
// Member functions definitions
string Batsman::displayData1(void)
{
return bCode;
}
// Main function for the program
main( )
{
Batsman az;
string bCd;
string nme;
int inns;
int runss;
int NtO;
cout<<"\n Enter Batsman Bcode \n";
cin>>bCd;
cout<<"\n Enter Batsman Name \n";
cin>>nme;
cout<<"\n Enter his number of innings \n";
cin>>inns;
cout<<"\n Enter number of not-outs \n througout his innings \n";
cin>>NtO;
cout<<"\n Enter number of runs he makes \n in his inning or innings \n";
cin>>runss;
az.readData1(bCd);
az.readData2(nme);
az.readData3(inns);
az.readData4(NtO);
az.readData5(runss);
az.readData6(runss,inns,NtO);
//az.readData6(runss,inns,NtO);
cout<<"\n Batsman Bcode \n ="<<az.displayData1();
cout<<"\n Batsman Name \n ="<<az.displayData2();
cout<<"\n Batsman Innings \n ="<<az.displayData3();
cout<<"\n Batsman Not-outs \n ="<<az.displayData4();
cout<<"\n Batsman Runs \n ="<<az.displayData5();
cout<<"\n Batsman Average \n="<<az.displayData6();
You have been asked multiple times to use code tags. PLEASE DO SO. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
If you're not going to make the slightest bit of effort to make your posts readable, why should we spend the slightest bit of effort helping you?
I will not respond further until you apply code tags.