//Purpose: Processes inputed English month, then calculates month // number and translates month name from English to German //By: ... //For: ... //Title: Assigment PP4 //Date: 20 June 2003 //------------------------------------------------------------------------------ #include #include #include #include char month_in [12]; //accepts an English month entered by the user int no_of_mth; //used as an index and counter to find month number void main () { //English month names array char mths_in_English[12][12] = {"January","February","March","April","May", "June","July","August","September","October", "November","December"}; //German month names array char mths_in_German[12][12] = {"Januar", "Februar","März","April","Mai","Juni", "Juli","August","September","Oktober","November", "Dezember"}; system ("cls"); //Greets and explains the purpose of program cout<< "This is month translation program. It recognises inputed English month," "\ndetermines its number, and translates it from English to German.\n\n"; //Promts for English name of month do { cout<< "Please enter the name of a month, in English (e.g. February): "; cin >> month_in; //Stores English month input //calculates month number for the inputed month for(no_of_mth = 0; no_of_mth < 13; no_of_mth++) { if(!strcmpi(month_in, mths_in_English[no_of_mth])) break; } if (no_of_mth > 12) { cout<<"\nInvalid month please enter a valid month!!\n\n"; } }while (no_of_mth > 12); //Displays the month number cout << "\nThe month typed is: " << mths_in_English[no_of_mth] << endl; cout << "\nIt is month number: " << no_of_mth + 1 << endl; //Displays inputed month in German cout << "\nIn German it reads: " << mths_in_German[no_of_mth]<<"\n\n"; system ("pause"); }