Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5430
Number of posts: 16951

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help with my Class Implementation Posted by Elii on 20 Sept 2012 at 8:19 PM
I need help with my assignment.

The first part:
This program is to simulate a dice and generates the number from 1 to 6.
Each number is associated to a prize like 1 is a car, 2 is a holiday, 3 dinner and so on

Im to construct this class implementation and specifications.

This is what ive done so far....

#include <iostream>
#include <cstdlib>
#include <ctime>

class MagicNumber
{
private:
	int number;
	string item;
	
public:
	MagicNumber();
	void setNumber(int);
	void setItem(string);
	int getNumber();
	string getItem();
	void display();
	int generateNumber();
};

MagicNumber::MagicNumber()
{
}

void MagicNumber::setNumber(int)
{
}

void MagicNumber::setItem(string)
{
}

int MagicNumber::getNumber()
{
	return number;
}

string MagicNumber::getItem()
{
	return item;
}

void MagicNumber::display()
{
}

int MagicNumber::generateNumber()
{
	srand(time(NULL)+rand());
    number=rand()%6+1;
}


So pls help me....



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.