I have to do a birthday project for by c++ class that allows the user to enter a birthay and dislay information about that birhday including the birhstone, astrological sign and the season which the birthday occurs. The main menu of the program should allow you to enter a persons name, birthday and additional info. It should continue to display until the user presses 1. Also create an enumeration for the months in the year, create an enumeration for the birthstones and add a function named get birthstone that returns the birthsone based on the month. It keeps telling me I have errors any suggestions?
Here is the code I have so far:

#include <iostream>
using namespace std;
#include<string>
using std::cout;
using std::endl;
using std::cin;
void printbirthstone (int);
void printastro (int);
void season (int);



int main()
{


string name;
int bdayyear = 2000;
int bdaymonth = 1;
int day = 1;
int birthstone = 1;
int astro = 1;
int season = 1;
int menu = 0;


cout <<"          *          *          *          *          *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"        *   *      *   *      *   *      *   *      *   *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"          *          *          *          *          *\n";


cout <<"Menu for Birthday Project\n";
cout <<"1. Please enter theperson's name:\n";
cout <<"2. Enter persons bithday year:\n";
cout <<"3. Enter persons birthday month:\n";
cout <<"4. Enter birthday day:\n";
cout <<"5. Display you birthstone:\n";
cout <<"6. Display your Astrological sign:\n";
cout <<"7. Display the season in which your birhday occurrs:\n";


cout <<"          *          *          *          *          *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"        *   *      *   *      *   *      *   *      *   *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"          *          *          *          *          *\n";


cout <<" Enter menu selection 1 through 7\n";
cin >>menu;


switch(menu)
{
case 1:
cin>>name;
break;


case 2:
cin>>bdayyear;
break;
case 3:
cin>>bdaymonth;
break;
case 4:
cin>>day;
break;
case 5:


break;
case 6:


break;
case 7:


break;


system("pause");
return 0;
}
void printbirthstone (int x)
{
switch (x0
{
case 1:
cout<<"Granet ";
break;
case 2:
cout<<"Amethyst ";
break;
case 3:
cout<<"Aquamarine ";
break;
case 4:
cout<<"Diamond ";
break;
case 5:
cout<<"Emerald ";
break;
case 6:
cout<<"Pearl ";
break;
case 7:
cout<<"Ruby ";
break;
case 8:
cout<<"Peridot ";
break;
case 9:
cout<<"Sapphire ";
break;
case 10:
cout<<"Opal ";
break;
case 11:
cout<<"Topaz ";
break;
case 12:
cout<<"Turquoise ";
break;
default
cout<<" Please enter a zodiac sign 1 to 12\n"


}
void printastro (int y)
{


}
void season (int z)
{



}

Edited 3 Years Ago by happygeek: fixed formatting

Using a beautifier to attempt to better read your code, I can see that syntax errors are an issue. Using code tags also assists in displaying this fact.

#include <iostream>
using namespace std;
#include<string>
using std::cout;
using std::endl;
using std::cin;
void printbirthstone (int);
void printastro (int);
void season (int);


int main()
{

   string name;
   int bdayyear = 2000;
   int bdaymonth = 1;
   int day = 1;
   int birthstone = 1;
   int astro = 1;
   int season = 1;
   int menu = 0;

   cout <<" * * * * *\n";
   cout <<" * * * * * * * * * *\n";
   cout <<" * * * * * * * * * *\n";
   cout <<" * * * * * * * * * *\n";
   cout <<" * * * * *\n";

   cout <<"Menu for Birthday Project\n";
   cout <<"1. Please enter theperson's name:\n";
   cout <<"2. Enter persons bithday year:\n";
   cout <<"3. Enter persons birthday month:\n";
   cout <<"4. Enter birthday day:\n";
   cout <<"5. Display you birthstone:\n";
   cout <<"6. Display your Astrological sign:\n";
   cout <<"7. Display the season in which your birhday occurrs:\n";

   cout <<" * * * * *\n";
   cout <<" * * * * * * * * * *\n";
   cout <<" * * * * * * * * * *\n";
   cout <<" * * * * * * * * * *\n";
   cout <<" * * * * *\n";

   cout <<" Enter menu selection 1 through 7\n";
   cin >>menu;

   switch ( menu )
   {
   case 1:
      cin>>name;
      break;

   case 2:
      cin>>bdayyear;
      break;
   case 3:
      cin>>bdaymonth;
      break;
   case 4:
      cin>>day;
      break;
   case 5:

      break;
   case 6:

      break;
   case 7:

      break;

      system("pause");
      return 0;
   }
   void printbirthstone (int x)
   {
      switch ( x0{case 1:
               cout<<"Granet ";
             break;case 2:
             cout<<"Amethyst ";
             break;case 3:
             cout<<"Aquamarine ";
             break;case 4:
             cout<<"Diamond ";
             break;case 5:
             cout<<"Emerald ";
             break;case 6:
             cout<<"Pearl ";
             break;case 7:
             cout<<"Ruby ";
             break;case 8:
             cout<<"Peridot ";
             break;case 9:
             cout<<"Sapphire ";
             break;case 10:
             cout<<"Opal ";
             break;case 11:
             cout<<"Topaz ";
             break;case 12:
             cout<<"Turquoise ";
             break;default
             cout<<" Please enter a zodiac sign 1 to 12\n"


             }
             void printastro (int y){


             }
             void season (int z){





             }

I placed a closing bracket and it is still showing 2 errors:

I believe this is line 77
'printbirthstone' : local function definitions are illegal

and
line 13 which has the follow error
this line contains a '{' which has not yet been matched

I placed a colon at the default case but it still showing the same two errors

Sorry bout that here is the current code

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


using std::cout;
using std::endl;
using std::cin;
void printbirthstone (int);
void printastro (int);
void season (int);



int main()
{


string name;
int bdayyear = 2000;
int bdaymonth = 1;
int day = 1;
int birthstone = 1;
int astro = 1;
int season = 1;
int menu = 0;


cout <<"          *          *          *          *          *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"        *   *      *   *      *   *      *   *      *   *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"          *          *          *          *          *\n";


cout <<"Menu for Birthday Project\n";
cout <<"1. Please enter theperson's name:\n";
cout <<"2. Enter persons bithday year:\n";
cout <<"3. Enter persons birthday month:\n";
cout <<"4. Enter birthday day:\n";
cout <<"5. Display you birthstone:\n";
cout <<"6. Display your Astrological sign:\n";
cout <<"7. Display the season in which your birhday occurrs:\n";


cout <<"          *          *          *          *          *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"        *   *      *   *      *   *      *   *      *   *\n";
cout <<"         * *        * *        * *        * *        * *\n";
cout <<"          *          *          *          *          *\n";


cout <<" Enter menu selection 1 through 7\n";
cin >>menu;


switch(menu)
{
case 1:
cin>>name;
break;


case 2:
cin>>bdayyear;
break;
case 3:
cin>>bdaymonth;
break;
case 4:
cin>>day;
break;
case 5:


break;
case 6:


break;
case 7:


break;



system("pause");
return 0;
}
void printbirthstone (int x)
{
switch (x)
{
case 1:
cout<<"Granet ";
break;
case 2:
cout<<"Amethyst ";
break;
case 3:
cout<<"Aquamarine ";
break;
case 4:
cout<<"Diamond ";
break;
case 5:
cout<<"Emerald ";
break;
case 6:
cout<<"Pearl ";
break;
case 7:
cout<<"Ruby ";
break;
case 8:
cout<<"Peridot ";
break;
case 9:
cout<<"Sapphire ";
break;
case 10:
cout<<"Opal ";
break;
case 11:
cout<<"Topaz ";
break;
case 12:
cout<<"Turquoise ";
break;
default:
cout<<" Please enter a zodiac sign 1 to 12\n"


}
void printastro (int y)
{


}
void season (int z)
{



}

Edited 3 Years Ago by happygeek: fixed formatting

switch ( menu ) needs a closing curly brace.
The function void printbirthstone (int x) needs a closing curly brace. cout<<" Please enter a zodiac sign 1 to 12\n" needs a closing semicolon ; .

Sometimes I like to "smash up" the switch when many things are common, mostly for easier readability.

#include <iostream>
#include <string>

using std::string;
using std::cout;
using std::endl;
using std::cin;

void printbirthstone (int);
void printastro (int);
void season (int);

int main()
{
   string name;
   int bdayyear = 2000, bdaymonth = 1, day = 1, birthstone = 1,
       astro = 1, season = 1, menu = 0;

   cout << " * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * *\n";

   cout << "Menu for Birthday Project\n";
   cout << "1. Please enter theperson's name:\n";
   cout << "2. Enter persons bithday year:\n";
   cout << "3. Enter persons birthday month:\n";
   cout << "4. Enter birthday day:\n";
   cout << "5. Display you birthstone:\n";
   cout << "6. Display your Astrological sign:\n";
   cout << "7. Display the season in which your birhday occurrs:\n";

   cout << " * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * *\n";

   cout <<" Enter menu selection 1 through 7\n";
   cin  >> menu;

   switch ( menu )
   {
   case 1: cin >> name;      break;
   case 2: cin >> bdayyear;  break;
   case 3: cin >> bdaymonth; break;
   case 4: cin >> day;       break;
   case 5:                   break;
   case 6:                   break;
   case 7:                   break;
   }

   system("pause");
   return 0;
}

void printbirthstone (int x)
{
   switch ( x )
   {
   case 1:  cout << "Granet ";     break;
   case 2:  cout << "Amethyst ";   break;
   case 3:  cout << "Aquamarine "; break;
   case 4:  cout << "Diamond ";    break;
   case 5:  cout << "Emerald ";    break;
   case 6:  cout << "Pearl ";      break;
   case 7:  cout << "Ruby ";       break;
   case 8:  cout << "Peridot ";    break;
   case 9:  cout << "Sapphire ";   break;
   case 10: cout << "Opal ";       break;
   case 11: cout << "Topaz ";      break;
   case 12: cout << "Turquoise ";  break;
   default: cout << " Please enter a zodiac sign 1 to 12\n";
   }
}

void printastro (int y)
{
}

void season (int z)
{
}

And this kinda thing gets old after week 3 of programming:

cout << " * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * * * * * * *\n";
   cout << " * * * * *\n";

;)

Im just learning C++, thanks for the tip I didn't know you could "smash up" the switches like that

This question has already been answered. Start a new discussion instead.