Funtion yearReading - Takes 2009 and 2014 and error checks the year of subscription
if te year is Below 2009 or above 2014 will issue the erro _ invalda month.
*******************************************************************************/
int yearReading (int& date);
Funtion yearReading - Takes 2009 and 2014 and error checks the year of subscription
if te year is Below 2009 or above 2014 will issue the erro _ invalda month.
*******************************************************************************/
int yearReading (int& date);
Funtion - subcriber_month - Takes 2009 and 2014 and error checks the year of subscription
if te year is Below 2009 or above 2014 will issue the erro _ invalda month.
*******************************************************************************/
int subcriber_month (int& buy_month);
Funtion - yearReading - five year span from 2004 to 2009 -if improper dates
are enter program should output - invalid year.
*******************************************************************************/
double yearReading ( double& start_date);
int month_conversion(int monthly, int monthly1);
int main()
{
int convert_month;
int subscribe_info;
int order_date;
int monthNumber;
int currentYear;
int begin_date;
int monthNumber1;//reuse function months
int expire_month;
cout << endl;
cout <<" Enter subscriber first name ";
getline (cin, firstName);
cout <<" Enter subscriber last name ";
getline (cin, lastName);
monthNumber = months();
currentYear = yearReading(begin_date);
cout <<" Expiration Date " <<expire_month<<" " <<static_cast<int> (expire_year);
cout << endl;
cout<<endl<<endl;
cout << "Press [enter] to exit" <<endl;
cin.ignore(); //needed because of keyboard input
cin.get();
return 0;
}
char ch,ch1,ch2,ch3;
int months ( ){
bool valid;
char ch, ch2, ch3, ch4;
int number;
cout << endl;
do {
cout << endl;
valid = true;
cout <<" Enter first letter of the subscription month ";
cin >> ch1;
switch (toupper(ch1)) {
case 'F': case 'f':
number = 2;
break;
case 'O': case 'o':
number = 10;
break;
case 'S':case 's':
number = 9;
break;
case 'N': case 'n':
number = 11;
break;
case 'D': case 'd':
number = 12;
break;
break;
case 'A':
case 'a':
cout << " Enter a second letter: ";
cin >> ch1;
switch (toupper(ch1)){
case 'P' :case 'p':
number = 04;
break;
case 'U': case 'u':
number = 8;
break;
}
break; //Break switch for April and August
case 'J': case 'j': // January, June, or July
cout << " Enter a second letter: ";
cin >> ch1;
switch (toupper(ch1)) { //Second switch for January, June and July
case 'A': case 'a':
number = 1;
break;
case 'U':
case 'u':
cout << " Enter a third letter: ";
cin >> ch2;
switch (toupper(ch2)) { //switch inside switch for June and July
case 'N': case 'n':
number = 06;
break;
case 'L': case 'l':
number = 07;
break;
}
break; //break from inside switch
}
break; //break from inner switch
case 'M':
case 'm':
cout << " Enter a second letter ";
cin >> ch2;
cout <<" Enter a third letter ";
cin >> ch3;
switch (toupper(ch3)) {
case 'R': case 'r':
number = 03;
break;
case 'Y': case 'y':
number = 05;
break;
}
break;
default:
valid = false;
}
if (valid)
{return number;}
else
{cout << " Invalid number";}
} while (true);
}
int yearReading ( int& date) {
cout <<" Enter subscription start year ";
cin >> date;
cout <<endl;
if ((START_YEAR > date)||( END_YEAR < date ))
{cout <<" Invalid year"<<endl;}
else
return date;
}
int subcriber_month (int& buy_month) {
int purchase_month;
cout <<" Enter the number of years subcribed " ;
cin >> purchase_month;
return purchase_month;
}
double yearReading ( double& start_date) {
const int BUY_YEAR = 2004;
cout <<" Enter subscription start year ";
cin >> start_date;
switch (toupper(ch1)) {
case 'J': // figure out Jan, June, or July
number = 1; //Jan for now
break;
case 'A': // April or Aug?
number = 4; // guess April
break;
case 'p': // April or Aug?
number = 8; // guess April
break;
case 'F': case 'f':
number = 2; // February
break;
case 'O': case 'o':
number = 10; // October
break;
case 'S':case 's':
number = 9;
break;
case 'N': case 'n':
number = November;
break;
case 'D':case 'd':
number = 12;
cout << endl;
break;
Great, so what's the question? It would help you tremendously if you were to post a description of what your program is supposed to do and what the specific problem is. It would help even more to properly format the code and paste it within code tags so that we can see it more clearly.
[qoute]I need the month_converter function to convert the numbers to the month it represents. The rest of the program is working ok. This is the last unser defined function. This is the only section of code I am concerned with. char ch,ch1,ch2,ch3 simply represent the inner and outer switches, not sure if I neeed then because the correct numbers have already been sent to main, ijust need to bring thost numbers back to month_converter function and conver them back to the months they represent.I have only included a portion of the months because once I get those working then I can include the other and finish designing the function.
THe question is How do I design the function so that it converts the numbers to the months they represent? Thanks
To : kempofighter if you observe the new people coding incorrectly,which my number of posts would clearly indicates, it would be tremendously helpful if you would also be courteous enough to show them how to correctly post a code. I am positive that none of the new posters and beginners as my self are intentionally posting code incorrectly. Sometimes people forget how it was when then starting coding. Nevertheless, it takes a lot less energy to be courteous and it does to be abrasive. [/quote]
Beginners are expected to read this before posting. Once in a while someone will explicitly type how to use code tags but honestly, we don't have time to retype the same information over and over, hence the reason that the above article was pinned to the top of the forum. I was actually being nice enough to explain what was wrong with the post so that you'd be more likely to get a helpful response.
To Kempofighter:
Thank you for posting the link and for calling my attention to the correct way to post code. Prehaps I took your first response the wrong way abd I apologize if my response was rude. Anyway thank you.