Alright, I'm working on this program in C++ condole that will pretty much Greet you, ask some birthday questions and display information... Good thing is. I got it working, But then I re-read the instructions and I was suppose to use a function to get the Month and Birthstone...
Sorry if my Pseudocode is crap
(long)
Code:
#include "stdafx.h"
#include <iostream> //Includes standard input-output library
#include <string> //Allows use of String
#include <cstdio> //Used for getchar
using std::cin; //Standard output stream
using std::cout; //Standard output stream
using std::endl; //End line command
using namespace std; //Uses namespace Std
int _tmain(int argc, _TCHAR* argv[]) //Start Program execution
{
string name; //Uses name as a String
int choice; //Choice for the Menu
int month,day; //Day and month of birth
string months;//Name of months
string stone; //Name of birthstones
int key; //A Wildcard for While loop
cout<<"Soo... what's your name?"<<endl;
cin>>name;
cout<<endl<<"What day(1-31) were you born?";
cin>>day;
cout<<endl<<"Which month(1-12) is that?";
cin>>month;
switch(month)
{
case 1:
months="January";
stone="Granet";
break;
case 2:
months="Febuary";
stone="Amethyst";
break;
case 3:
months="March";
stone="Aquamarine";
break;
case 4:
months="Apirl";
stone="Diamond";
break;
case 5:
months="May";
stone="Emerald";
break;
case 6:
months="June";
stone="Pearl";
break;
case 7:
months="July";
stone="Ruby";
break;
case 8:
months="Augest";
stone="Peridot";
break;
case 9:
months="September";
stone="Sapphire";
break;
case 10:
months="October";
stone="Opal";
break;
case 11:
months="November";
stone="Topaz";
break;
case 12:
months="December";
stone="Turquoise";
break;
}
cout<<"Thank you."<<endl<<endl;
while(key)
{
cout<<"____________________________________"<<endl;//Displays the Diamond Header
cout<<"|* * * * *|"<<endl;//^^
cout<<"| ** *** *** *** ** |"<<endl;//^^
cout<<"| *** ***** ***** ***** *** |"<<endl;//^^
cout<<"| ** *** *** *** ** |"<<endl;//^^
cout<<"| * * * * * |"<<endl;//^^
cout<<"------------------------------------"<<endl;//^^
cout<<" Welcome "<< name << "!" <<endl;//Welcome User
cout<<" Born: "<<months<<" - "<<day<<endl;// Displays Birthday Info
cout<<"____________________________________"<<endl;//^^
cout<<"| (1)Birthstone |"<<endl;//Displays Menu
cout<<"| (2)Astrological |"<<endl;//^^
cout<<"| (3)Season |"<<endl;//^^
cout<<"| (9)Exit |"<<endl;//^^
cout<<"|__________________________________|"<<endl;//Displays the Diamond Footer
cout<<"| * * * * * |"<<endl;//^^
cout<<"| ** *** *** *** ** |"<<endl;//^^
cout<<"| *** ***** ***** ***** *** |"<<endl;//^^
cout<<"| ** *** *** *** ** |"<<endl;//^^
cout<<"|* * * * *|"<<endl;//^^
cout<<"------------------------------------"<<endl;//^^
cout<<"Select Number catagory you wish to view."<<endl;//Prompts User
cin>>choice; //User's input
switch(choice)//Chooses Menu Options
{
case 1: //If Option 2
cout<<"_____________"<<endl;//Display
cout<<"|Brithstone!|"<<endl;//^^
cout<<"-------------"<<endl;//^^
cout<<"Ok, let's see... You were born on "<<months<<endl;//Displays Text & Month
cout<<"So that means your birthstone is "<<stone<<endl;//Displays Text & Stone
break;
case 2: //Option 2
cout<<"Not Avaiable"<<endl<<endl;//Display
break;
case 3: // Option 3
cout<<"Not Avaiable"<<endl<<endl;
break;
case 9: // Option 9
cout<<"Exit"<<endl<<endl;
return 0; //Ends Program
break;
default: // If no other option is made
cout<<"Please choose options 1-3 or 9 to Exit"<<endl<<endl;;
break;
}
}
}
As you can see, it works. at least as far as i got. Birthstones and all with a endless menu loop unless 9, makes return 0 and ends the program.
I somehow have to convert the first "cases" into a function to call on to determin the birthstone for the month.. but I used the switch for the month Number to Text conversion and birthstone code... I tried a few different ways from
With these as global declarations
Code:
int month(int);//Global Month integer
string months;
strong stone;
Code:
int getBirthstone(int)
{
switch(month)
{
case 1:
months="January";
stone="Garnet";
break;
case 2:
months="February";
stone="Amethyst";
break;
case 3:
months="March";
stone="Aquamarine";
break;
case 4:
months="April";
stone="Diamond";
break;
case 5:
months="May";
stone="Emerald";
break;
case 6:
months="June";
stone="Pearl";
break;
case 7:
months="July";
stone="Ruby";
break;
case 8:
months="August";
stone="Peridot";
break;
case 9:
months="September";
stone="Sapphire";
break;
case 10:
months="October";
stone="Opal";
break;
case 11:
months="November";
stone="Topaz";
break;
case 12:
months="December";
stone="Turquoise";
break;
}
}
Help if you can, I'll still be looking around.