954,487 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C++ class of integers finding the mode

Hi,
I have a basic understanding of C++ and was creating something myself with a class of 6 integers and a string what I want to do is to be able to find the mode values for each of the six integers and strings I have instantiated a set of objects for the class that contain the values and I want to find the mode values in the objects.
I reached this far it all works so far as I have created the class the interface and the main methodbut i got stuck on finding the mode could some one please help me

Thanks

Kunal

Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

Could you please post your code (so far) So we have something to work on =)

phorce
Posting Whiz
362 posts since Jul 2011
Reputation Points: 31
Solved Threads: 26
 

This is a personal project I want to create for myself to learn OO dev for C++I split it up into 3 files it is for the lottery to help me choose 6 of the most occurring values heres my code:
1)the class file/ interface:

#include<iostream>
using namespace std;
class lottery
{
public:
	lottery(int,int,int,int,int,int,int,string);
	//get methods
	int get_Ball_1();
	int get_Ball_2();
	int get_Ball_3();
	int get_Ball_4();
	int get_Ball_5();
	int get_Ball_6();
	int get_Bonus();
	string get_Machine_Name();
	//set methods
	void set_Ball_1(int ball1);
	void set_Ball_2(int ball2);
	void set_Ball_3(int ball3);
	void set_Ball_4(int ball4);
	void set_Ball_5(int ball5);
	void set_Ball_6(int ball6);
	void set_Bonus(int ballBonus);
	void set_Machine_Name(string);
	void display_results();
	int get_ball_1_Mode();
	int get_ball_2_Mode();
	int get_ball_3_Mode();
	int get_ball_4_Mode();
	int get_ball_5_Mode();
	int get_ball_6_Mode();
	int get_bonus_Mode();
	int get_Name_Mode();
private:
	int ball_1;
	int ball_2;
	int ball_3;
	int ball_4;
	int ball_5;
	int ball_6;
	int bonus;
	string machine_name;
};

2) the code behind the class

#include<iostream>
#include<string>
#include"Lottery.h";//include the lottery object header
using namespace std;
//constructor
lottery::lottery(int b1, int b2, int b3, int b4, int b5, int b6, int bon, string name)
{
	set_Ball_1( b1 );//call set functions to set ball numbers
	set_Ball_2( b2 );
	set_Ball_3( b3 );
	set_Ball_4( b4 );
	set_Ball_5( b5 );
	set_Ball_6( b6 );
	//set the bonus ball
	set_Bonus( bon );
	//set Machine name
	set_Machine_Name( name );
}//end Lottery constructor
//set methods
void lottery::set_Ball_1(int b1)
{
	ball_1 = b1;//store the ball1 in the object
}//end set_Ball_1 function
void lottery::set_Ball_2(int b2)
{
	ball_2 = b2;//store the ball 2 in the object
}//end set_Ball_2 function
void lottery::set_Ball_3(int b3)
{
	ball_3= b3; // store ball 3 in the object
}//end set ball_3 function
void lottery::set_Ball_4(int b4)
{
	ball_4 = b4;//store ball4 in the object
}//end set ball_4 function
void lottery::set_Ball_5(int b5)
{
	ball_5 = b5;//store ball4 in the object
}//end set ball_5 function
void lottery::set_Ball_6(int b6)
{
	ball_6= b6;//store ball6 in the object
}//end set ball_6 function
void lottery::set_Bonus(int Bon)
{
	bonus = Bon;
}//end function set_bonus
void lottery::set_Machine_Name(string name)
{
	machine_name = name;
}//end setMachine name
//get methods
int lottery::get_Ball_1()
{
return lottery::ball_1;//return Ball_1
}//end get ball 1 method
int lottery::get_Ball_2()
{
	return lottery::ball_2; // returns ball2 object
} //end get_ball_2 function
int lottery::get_Ball_3()
{
	return ball_3; //return ball_3 object
} //end get_ball_3 function
int lottery::get_Ball_4()
{
	return ball_4; //return ball_2 object
} //end get_ball_4 function
int lottery::get_Ball_5()
{
	return ball_5; //return ball_2 object
} //end get_ball_5 function
int lottery::get_Ball_6()
{
	return ball_6; //return ball_2 object
} //end get_ball_6 function
int lottery::get_Bonus()
{
	return bonus;//returns bonus ball
}//end the get function
string lottery::get_Machine_Name()
{
	return machine_name;//returns the machine_Name
}//end the get macine name function
void lottery::display_results()
{
	cout<< get_Ball_1()<<"-"<< get_Ball_2()<<"-"<< get_Ball_3()<<"-"<< get_Ball_4()<<"-"<< get_Ball_5()<<"-"<< get_Ball_6()<<" \tBonus: "<< get_Bonus()<<endl;
	cout<<"Machine: "<< get_Machine_Name() <<endl;
}
//find modes im stuck here I commented it out on purpose
/*int lottery::get_ball_1_Mode()
{
	
	return Mode_1;
}
int lottery::get_ball_2_Mode()
{
	
	return Mode_2;
}
int lottery::get_ball_3_Mode()
{
	return mode_3;
}
int lottery:: get_ball_4_Mode()
{
	return mode_4;
}
int lottery::get_ball_5_Mode()
{
	return mode_5;
}
int lottery::get_ball_6_Mode()
{
	return mode_6;
}
int lottery::get_Bonus()
{
	return Mode_Bonus;
}*/

3) the file with the main function

#include<iostream>
#include<string>
#include"Lottery.h";
using namespace std;
//main to create lottery objects
void load_Jun_draws()
{
	lottery lottery_22_06(16,22,23,36,45,48,19,"GUINEVERE");
	lottery lottery_25_06(5,9,15,30,32,39,31,"GUINEVERE");
	lottery lottery_29_06(5,6,13,21,31,47,30,"ARTHUR");
	cout<<"Lottery objects created for Jun 2011"<<endl;
}
void load_Jul_draws()
{
	lottery lottery_02_07(10,18,34,35,39,48,6,"GUINEVERE");
	lottery lottery_06_07(26,32,34,35,41,48,1,"GUINEVERE");
	lottery lottery_09_07(1,2,21,24,33,49,39,"ARTHUR");
	lottery lotter_13_07(7,11,15,18,19,49,25,"ARTHUR");
	lottery lottery_16_07(4,9,13,15,18,40,30,"GUINEVERE");
	lottery lottery_20_07(6,10,15,32,42,49,4,"ARTHUR");
	lottery lottery_23_07(1,2,11,30,33,45,39,"ARTHUR");
	lottery lottery_27_07(4,16,22,34,39,42,35,"ARTHUR");
	lottery lottery_30_07(4,10,29,32,34,40,48,"GUINEVERE");
	cout<<"Lottery objects created for Jul 2011"<<endl;
}
void load_Aug_draws()
{
	lottery lottery_03_08(18,19,26,39,40,47,4,"GUINEVERE");
	lottery lottery_06_08(1,14,18,24,26,28,19,"ARTHUR");
	lottery lottery_10_08(2,4,7,27,43,44,45,"ARTHUR");
	lottery lottery_13_08(5,30,31,33,35,45,3,"ARTHUR");
	lottery lottery_17_08(3,19,32,40,47,48,37,"GUINEVERE");
	lottery lottery_20_08(2,3,18,30,34,35,24,"ARTHUR");
	lottery lottery_24_08(11,27,46,47,48,49,42,"ARTHUR");
	lottery lottery_27_08(6,7,29,32,41,46,49,"GUINEVERE");
	lottery lottery_31_08(5,26,43,46,47,49,28,"GUINEVERE");
	cout<<"Lottery objects created for Aug 2011"<<endl;
}
void load_Sep_draws()
{
	lottery lottery_03_09(4,17,20,26,29,36,31,"ARTHUR");
	lottery lottery_07_09(4,29,31,36,38,48,35,"GUINEVERE");
	lottery lottery_10_09(5,7,9,10,22,47,37,"GUINEVERE");
	lottery lottery_14_09(23,28,29,37,38,42,49,"ARTHUR");
	lottery lottery_17_09(2,3,6,41,44,45,10,"GUINEVERE");
	lottery lottery_21_09(11,15,32,33,37,39,28,"GUINEVERE");
	lottery lottery_24_09(10,16,29,34,37,47,31,"GUINEVERE");
	lottery lottery_28_09(15,19,25,36,44,45,43,"GUINEVERE");
	cout<<"Lottery objects created for Sep 2011"<<endl;
}
void load_Oct_draws()
{
	lottery lottery_02_10(4,15,17,26,37,41,29,"GUINEVERE");
	lottery lottery_05_10(9,15,17,29,30,39,11,"GUINEVERE");
	lottery lottery_08_10(6,16,22,26,30,34,45,"ARTHUR");
	lottery lottery_12_10(13,24,25,26,37,40,30,"ARTHUR");
	lottery lottery_15_10(7,12,27,34,41,46,14,"ARTHUR");
	lottery lottery_19_10(13,14,18,32,34,49,20,"GUINEVERE");
	lottery lottery_22_10(20,27,28,34,43,44,1,"ARTHUR");
	lottery lottery_29_10(5,9,14,28,46,49,45,"GUINEVERE");
	cout<<"Lottery objects created for Oct 2011"<<endl;
}
void load_Nov_draws()
{
	lottery lottery_02_11(11,12,33,37,38,49,3,"GUINEVERE");
	lottery lottery_05_11(14,16,23,24,27,39,43,"LANCELOT");
	lottery lottery_09_11(2,8,10,23,27,32,44,"GUINEVERE");
	lottery lottery_12_11(6,12,13,28,33,38,10,"ARTHUR");
	lottery lottery_16_11(10,12,26,27,39,40,20,"GUINEVERE");
	lottery lottery_19_11(1,29,31,32,34,36,45,"ARTHUR");
	lottery lottery_23_11(4,11,19,22,31,48,6,"MERLIN");
	lottery lottery_26_11(13,16,25,26,36,46,15,"MERLIN");
	lottery lottery_30_11(13,23,24,25,26,30,4,"MERLIN");
	cout<<"Lottery objects created for Nov 2011"<<endl;
}
	void load_Dec_draws()
{
	lottery lottery_03_12(1,30,35,47,48,49,8,"MERLIN");
	lottery lottery_07_12(10,14,27,31,32,47,41,"MERLIN");
	lottery lottery_10_12(16,21,24,29,30,39,20,"LANCELOT");
	lottery lottery_14_12(3,10,25,28,30,43,31,"MERLIN");
	cout<<"Lottery objects created till 14/12/2011"<<endl;
}
int main()
{
	//create lottery objects for June 2011
	load_Jun_draws();	
	load_Jul_draws();
	load_Aug_draws();
	load_Sep_draws();
	load_Oct_draws();
	load_Nov_draws();
	load_Dec_draws();
}

this quite possibly was the most labourious way to code but Its the way I was learningany help to create the mode from the classes would be great
Thanks for your help...

Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

Firstly... Your class can be written a lot better:

class

class Lottery 
{
	public:
	         void setBall(int theBall);
		 int getBall();
	private:
		int ball;
};


functions

#include<iostream>
#include<string>
#include"Lottery.h";//include the lottery object header
using namespace std;
//constructor

lottery::lottery(int theBall)
{
     ball = theBall;
}

void lottery::setBall(int theBall)
{
   ball = theBall;
}
int lottery::getBall()
{
    return ball;
}


And then in main you could have:

#include <iostream>
#include "lottery.h"
using namespace std;
int main(int argc, char *argv[]) {

	Lottery lottery[500]; // 500 objects
	
	lottery[0].setBall(40);
	
	return EXIT_SUCCESS;
}


Then you'd have an array to work with. I haven't compiled this, but, this seems to be a much better way to set out classes than what you have (Not saying you're wrong, an excellent attempt) But.. You don't need to declare that many integers when you can use arrays :)

phorce
Posting Whiz
362 posts since Jul 2011
Reputation Points: 31
Solved Threads: 26
 

how about the 6 balls i want to set values for or do i only add them one at a time to a long array and the previous results i want to draw the mode from.

Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

They'd just be an array.. 2 seconds, let me try something :)

phorce
Posting Whiz
362 posts since Jul 2011
Reputation Points: 31
Solved Threads: 26
 

would this not work for main

#include<iostream>
#include"lottery.h";
using namespace std;
int main()
{
lottery lottery[500]//create 500 array size object

lottery[0].set_Ball_1(40);//set all lottery objects
lottery[0].set_Ball_2(03);
lottery[0].set_Ball_3(05);
lottery[0].set_Ball_4(12);
lottery[0].set_Ball_5(10);
lottery[0].set_Bonus(21);
}
Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

i dunno if this would work but:

Class "Lottery.h"

class Lottery
{
    public:
        Lottery();
    
        Lottery(int &theBalls);
        void setBall(int theBall);
        int getBall();
    private:
        int ball;
        int balls[500];
    
};


Functions "Lottery.cpp"

#include<iostream>
#include<string>
#include "Lottery.h";

Lottery::Lottery(){};

Lottery::Lottery(int &theBalls)
{
    // Could store them into an array
    // Can someone help with this?
    
}

void Lottery::setBall(int theBall)
{
    ball = theBall;
    
}

int Lottery::getBall()
{
    return ball;
    
}


Main "main.cpp"

#include <iostream>
#include "Lottery.h"

using namespace std;
Lottery lottery[500];


void january()
{
    lottery[0].setBall(10);
    lottery[1].setBall(20);
    lottery[2].setBall(30);
    
}

void feb()
{
    lottery[3].setBall(3403234);
    lottery[4].setBall(2140214);
    lottery[5].setBall(2140214);
}

int main()
{    
    january();
    cout << lottery[0].getBall() << endl;
    
    return EXIT_SUCCESS;
}


If that makes sense? I don't want to go into like Maps and stuff. Do you have to do it using a class?

Hope this helps you though... For the Mode, you could get the data range of a specific month!

phorce
Posting Whiz
362 posts since Jul 2011
Reputation Points: 31
Solved Threads: 26
 

Thank you for your help im going to try it later bit busy right now
could you explainwht you mean in main by

return Exit_SUCCESS;
}
Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

Thank you for your help im going to try it later bit busy right now could you explainwht you mean in main by

return Exit_SUCCESS;
}

Basically, it's a return type.. Just returns like "TRUE" or "FALSE" you should add it to every main/function (that isn't void)

int numbers(int number1, int number2)
{
    if(number1 > number2)
    {
      return true;
    }else{
      return false;
    }
}

if(numbers(1, 4))
{
    cout << "False";
}else{
   cout << "True";
}


Make sense? =)

phorce
Posting Whiz
362 posts since Jul 2011
Reputation Points: 31
Solved Threads: 26
 

1)right ok I created this i've fallen again im afraid
i have madde the class like this

#include<iostream>
#include<string>
using namespace std;
class lottery
{
public:
	lottery(int, int,int,int,int,int,int,string);
	int get_Ball_1();
	int get_Ball_2();
	int get_Ball_3();
	int get_Ball_4();
	int get_Ball_5();
	int get_Ball_6();
	int get_Bonus();
	string get_machine_Name();

	//set balls
	void set_Ball_1( int );
	void set_Ball_2( int );
	void set_Ball_3( int );
	void set_Ball_4( int );
	void set_Ball_5( int );
	void set_Ball_6( int );
	void set_Bonus( int );
	void set_Machine_Name( string );
	void lottery::display_results();
private:
	int balls[7];
	string machine_name;
};

2)I have made functions like this

#include<iostream>
#include<string>
using namespace std;
#include"lottery.h";
//constructor
lottery::lottery(int b1, int b2, int b3, int b4, int b5, int b6, int bonus, string name)
{
	set_Ball_1( b1 );
	set_Ball_2( b2 );
	set_Ball_3( b3 );
	set_Ball_4( b4 );
	set_Ball_5( b5 );
	set_Ball_6( b6 );
	//set bonus
	set_Bonus( bonus );
	//set machine name
	set_Machine_Name( name);
}//end constructor
//set methods
void lottery::set_Ball_1(int b1)
{
	balls[0]=b1;
}//end set ball 1 function

void lottery::set_Ball_2(int b2)
{
	balls[1]=b2;
}//end set ball 2 function

void lottery::set_Ball_3(int b3)
{
	balls[2]= b3;
}//end set ball 3 function
void lottery::set_Ball_4(int b4)
{
	balls[3] = b4;
}//end set ball 4 function
void lottery::set_Ball_5(int b5)
{
	balls[4] = b5;
}//end set ball 5 function
void lottery::set_Ball_6(int b6)
{
	balls[5] = b6;
}//end set ball 6 function
void lottery::set_Bonus(int b7)
{
	balls[6] = b7;
}//end set bonus function
void lottery::set_Machine_Name(string nam)
{
	machine_name = nam;
}
//get methods
int lottery::get_Ball_1 ()
{
	return balls[0];
}//end get ball 1 function
int lottery::get_Ball_2 ()
{
	return balls[1];
}//end get ball 2 function
int lottery::get_Ball_3 ()
{
	return balls[2];
}//end get ball 3 function
int lottery::get_Ball_4 ()
{
	return balls[3];
}//end get ball 4 function
int lottery::get_Ball_5 ()
{
	return balls[4];
}//end get ball 5 function
int lottery::get_Ball_6 ()
{
	return balls[5];
}//end get ball 6 function
int lottery::get_Bonus ()
{
	return balls[6];
}//end get bonus ball  function
string lottery::get_machine_Name()
{
	return machine_name;
}//end get machine name function

void lottery::display_results()
{
	cout<< get_Ball_1() <<"-"<< get_Ball_2() <<"-"<< get_Ball_3() <<"-"<< get_Ball_4() 
		<<"-"<< get_Ball_5() <<"-"<< get_Ball_6() <<"\t"<< "Bonus: "<< get_Bonus() <<endl;
	cout<<"Machine: " <<get_machine_Name() <<endl;
}//end display results

3) I have created the main function like this however it says here array function not defined I dont understand what to do

#include<iostream>
#include<string>
#include"lottery.h";
using namespace std; 
//main function
int main()
{
	//create draws
	lottery lottery_Guinevere[80](<strong>)</strong>;error here right bracket;


}
Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

Given the number of balls in play, it may be better to have a generalized get_Ball() function which take an index argument:

int get_Ball(int ball_no)
    {
        return balls[ball_no - 1]; 
    }

You could even write it as an operator[] function which would allow you to treat it similarly to an array.

OTOH, I'm not sure you want a set_Ball() function at all. The entire point of this is to generate the balls randomly, correct? If so, that should be a (private) operation of the Lottery machine object - setting or changing the values from outside of the lottery machine ought to be prevented. Similarly, the c'tor shouldn't have to take the generated values in at the start, because the purpose of the Lottery object is to do the generating for you.

Schol-R-LEA
Posting Pro
556 posts since Oct 2010
Reputation Points: 254
Solved Threads: 85
 

Im sorry I just got back to this im still new to this programming type i dont fully understand this index and operator I want to create an array from my class but use the default constructor with no values, then lateer I want to set the values as classesI create in the array but it says it cant do that I dont understand.. sorry

Kunal

Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

One of the reasons for OOP is to reuse code, avoid useless repetition. It would be much cleaner if u declare 1 function.

v3ga
Junior Poster in Training
95 posts since Oct 2011
Reputation Points: 14
Solved Threads: 4
 

do you mean just do it all in a main function

Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

Hi I think i need to justify this,
the reason im making a class is :
I'm looking to enter the last 6 months draws as objects with arrays I then want the program to look at these draws and tell me what are the top 6 numbers drawn i did this as a class of integers at the beginning but found it was not easy to reference these lster when it came to searching through the objects hence i want to create an array of objects to reference then loop through searching the objects, but in the main function it says I cant create an aray of my objects any ideas how I can overcome this, i thought it would be easier as a class as i can create objects for each draw entering the numbers and then iteratively by an algorithm search through them for the top 6 values
any help would be great
Thanks

Kunal

Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 
do you mean just do it all in a main function

No; quite the opposite, in fact. What v3ga was talking about was the getBall<em>x</em>() functions, versus the single getBall() function I proposed. What he meant was that having six separate functions which do more or less the same operation is a bad design approach; it is better to have a single function that takes a parameter to decide which of the six you should be operating on.

Schol-R-LEA
Posting Pro
556 posts since Oct 2010
Reputation Points: 254
Solved Threads: 85
 
i want to create an array of objects to reference then loop through searching the objects, but in the main function it says I cant create an array of my objects any ideas how I can overcome this

Odd, it certainly should allow you to create such an array. Could you post the code you had tried to use, and the exact error messages you were getting?

Schol-R-LEA
Posting Pro
556 posts since Oct 2010
Reputation Points: 254
Solved Threads: 85
 

1)I have made my class DEFINITION like this:

#include<iostream>
#include<string>
using namespace std;
class lottery
{
public:
	lottery(int, int,int,int,int,int,int,string);
	int get_Ball_1();
	int get_Ball_2();
	int get_Ball_3();
	int get_Ball_4();
	int get_Ball_5();
	int get_Ball_6();
	int get_Bonus();
	string get_machine_Name();

	//set balls
	void set_Ball_1( int );
	void set_Ball_2( int );
	void set_Ball_3( int );
	void set_Ball_4( int );
	void set_Ball_5( int );
	void set_Ball_6( int );
	void set_Bonus( int );
	void set_Machine_Name( string );
	void lottery::display_results();
private:
	int balls[7];
	string machine_name;
};

2)I have created the class implementation like this:

#include<iostream>
#include<string>
using namespace std;
#include"lottery.h";
//constructor
lottery::lottery(int b1, int b2, int b3, int b4, int b5, int b6, int bonus, string name)
{
	set_Ball_1( b1 );
	set_Ball_2( b2 );
	set_Ball_3( b3 );
	set_Ball_4( b4 );
	set_Ball_5( b5 );
	set_Ball_6( b6 );
	//set bonus
	set_Bonus( bonus );
	//set machine name
	set_Machine_Name( name);
}//end constructor
//set methods
void lottery::set_Ball_1(int b1)
{
	balls[0]=b1;
}//end set ball 1 function

void lottery::set_Ball_2(int b2)
{
	balls[1]=b2;
}//end set ball 2 function

void lottery::set_Ball_3(int b3)
{
	balls[2]= b3;
}//end set ball 3 function
void lottery::set_Ball_4(int b4)
{
	balls[3] = b4;
}//end set ball 4 function
void lottery::set_Ball_5(int b5)
{
	balls[4] = b5;
}//end set ball 5 function
void lottery::set_Ball_6(int b6)
{
	balls[5] = b6;
}//end set ball 6 function
void lottery::set_Bonus(int b7)
{
	balls[6] = b7;
}//end set bonus function
void lottery::set_Machine_Name(string nam)
{
	machine_name = nam;
}
//get methods
int lottery::get_Ball_1 ()
{
	return balls[0];
}//end get ball 1 function
int lottery::get_Ball_2 ()
{
	return balls[1];
}//end get ball 2 function
int lottery::get_Ball_3 ()
{
	return balls[2];
}//end get ball 3 function
int lottery::get_Ball_4 ()
{
	return balls[3];
}//end get ball 4 function
int lottery::get_Ball_5 ()
{
	return balls[4];
}//end get ball 5 function
int lottery::get_Ball_6 ()
{
	return balls[5];
}//end get ball 6 function
int lottery::get_Bonus ()
{
	return balls[6];
}//end get bonus ball  function
string lottery::get_machine_Name()
{
	return machine_name;
}//end get machine name function

void lottery::display_results()
{
	cout<< get_Ball_1() <<"-"<< get_Ball_2() <<"-"<< get_Ball_3() <<"-"<< get_Ball_4() 
		<<"-"<< get_Ball_5() <<"-"<< get_Ball_6() <<"\t"<< "Bonus: "<< get_Bonus() <<endl;
	cout<<"Machine: " <<get_machine_Name() <<endl;
}//end display results

3) I have the main function like this it has an error on the right bracket in aray declaration saying error Array function ont allowed

#include<iostream>
#include<string>
#include"lottery.h";
using namespace std; 
//main function
int main()
{
	//create draws
	lottery lottery_Guinevere[80]();error here right bracket;


}#include<iostream>
#include<string>
#include"lottery.h";
using namespace std; 
//main function
int main()
{
	//create draws
	lottery lottery_Guinevere[80]();error here right bracket;
}
Kunal0
Newbie Poster
14 posts since Dec 2011
Reputation Points: 6
Solved Threads: 0
 

That is not how you should create the object it should be
lottery lottery_Guinevere[80] no need of brackets

v3ga
Junior Poster in Training
95 posts since Oct 2011
Reputation Points: 14
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
 
View similar articles that have also been tagged: