I need to create two enumerations, one for the months in the year and the other for birthstones.

Make a function named getBirthStone that returns the birthstone based on the month.
Jan-garnet
Feb-amethyst
Mar-aquamarine
Apr-diamond
May-emerald
June-pearl
July-ruby
Aug-peridot
Sep-sapphire
Oct-opal
Nov-topaz
Dec-turquoise

Add code to call the function when the user selects the display information option.

Include a menu item to the main menu to display all birth stones. Add code to call getBirthstone for each month.

I have started the assignment, but I'm not quite sure what I'm doing wrong. Any help is highly appreciated!!

#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

Bstone::Bstone ( string );	// consructor intializes Bstone with string supplied as argument

int main()
{
	int name;	//the user's name
	int Bday;	//the user's birthday

	//prompting the user for their name
	cout << "Please enter your name:\n ";
	cin >> name;

	//prompting user for their birthday 
	cout << "Please enter your birthday:\n ";
	cin >> Bday;

	//prompting the user to select one of the following.
	cout << "Please select the following, which you want to display:\n ";

	//beginning of the switch statement.
	switch (Useroptions)
	{
		case 1:	//displaying the user's birthstone.
			cout << "Here is " << name << " birthstone \n";
			cout << "His birthday is " << Bday;
			break;
		case 2:	//displaying the user's astrogical sign.
			cout << name << " astrogical sign is " << ....;
			break;
		case 3:	//displaying the season of which the user's birthday occurs in.
			cout << " The season in which " << name << " birthday occurs " << "....";
			break;
			default;
	}

	char Months, BirthStone;	// Months and Birthstones of the potential users
	
	// enumeration declaration for months
	enum Months { Jan = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };
	
	// enumeration declaration for birthstones
	enum BirthStone { GARNET = 1, AMETHYST, AQUAMARINE, DIAMOND, EMERALD, PERAL, RUBY, PERIDOT, SAPPHIRE, OPAL, TOPAZ, TURQUOISE };

	string Bstone::getBirthStone()
	{
	return Birthstone;
	}	//end function getbirthstone


return 0;
}

Recommended Answers

All 3 Replies

First of all, please surround your code with code tags or it makes it very hard for us to read. Second I would do this with array's, it seems it would make more sense, but this is an assignment.. Last, i would help you but you didn't do really anything just made a base and doesn't show me that you tried much.
I would love to help you but not enough effort was put into what you have so far.

You are not doing anything wrong, you just did not do anything accept for get it ready to be coded...

commented: Look at the code you didnt find even one mistake ??? thats strange... +0

You are not doing anything wrong, you just did not do anything accept for get it ready to be coded...

@u8sand : I really think you need to look at the code first and then give your comments.I found all the mistakes listed below.And you didn't find even one ??? Which compiler do you use by the way ? The one which corrects errors on its own ??? ;)

@GooeyG:

Lots of mistakes as such :

1>Where is Bstone class defined...???

2>

switch(Useroptions)

Where are you asking the user for options???

3>

default; //Default with a semicolon ???

4>Class member function defined within main ???

5>Enumeration within main ???

6>Name and Bdate that too integer ???

And many others...So correct them first.

Where are you instantiating your class ? main should just have that , move the rest of code in another file say birthstone.c/birthstone.h .

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.