Product expiration dates are often encoded using numbers and letters which encode the month day and year. A common technique is to use letters instead of numbers in the dates. Assume that ACME Bakers encodes the months using letters "A" through "L", each digit of the expiration date as the three letters "Q" through "Z", (where "Q" is 0 and "Z" is 9), and the year as the letters "Z" through "A" plus 1988 (where "Z" is 1 and "A" is 26).
Your program (and all design documentation) shall present two options to the user:
First- decode an expiration code and secondly encode a date.
If the decode option is selected, your program will prompt user for an encoded expiration data from ACME Bakers and decodes it. Days of the month that have only one digit (e.g, April 3, 1993) should be printed with a single digit, not with two date digits (e.g, April 03, 1993).
If the encode option is selected, your program will accept as input a date (i.e., October 31, 1993), and encode it into the above described code (i.e., JTRV).
Your program must check for and handle incorrect date and code formats.
I'm having a problem trying to come up with statements(if/else) which could encode and decode. See what I have below, thanks for the assistance.
#include <iostream>
#include <string>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
int main()
{
int monthA=1;//Months during the year.
int monthB=2;
int monthC=3;
int monthD=4;
int monthE=5;
int monthF=6;
int monthG=7;
int monthH=8;
int monthI=9;
int monthJ=10;
int monthK=11;
int monthL=12;
int dayQ=0;//Days
int dayR=1;
int dayS=2;
int dayT=3;
int dayU=4;
int dayV=5;
int dayW=6;
int dayX=7;
int dayY=8;
int dayZ=9;
int yearA=26+1988;//Years
int yearB=25+1988;
int yearC=24+1988;
int yearD=23+1988;
int yearE=22+1988;
int yearF=21+1988;
int yearG=20+1988;
int yearH=19+1988;
int yearI=18+1988;
int yearJ=17+1988;
int yearK=16+1988;
int yearL=15+1988;
int yearM=14+1988;
int yearN=13+1988;
int yearO=12+1988;
int yearP=11+1988;
int yearQ=10+1988;
int yearR=9+1988;
int yearS=8+1988;
int yearT=7+1988;
int yearU=6+1988;
int yearV=5+1988;
int yearW=4+1988;
int yearX=3+1988;
int yearY=2+1988;
int yearZ=1+1988;
cout<<"Decode an expiration date"<<endl;
cin>>
cout<<"Encode a date"<<endl;
cin>>
cout<<decode<<endl;
return 0;