Computers and Technology

Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substr() function to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990. Ex: If the input is:
March 1, 1990
April 2 1995
7/15/20
December 13, 2003
-1
then the output is:
3/1/1990
12/13/2003
#include
#include
using namespace std;
int DateParser(string month) {
int monthInt = 0;
if (month == "January")
monthInt = 1;
else if (month == "February")
monthInt = 2;
else if (month == "March")
monthInt = 3;
else if (month == "April")
monthInt = 4;
else if (month == "May")
monthInt = 5;
else if (month == "June")
monthInt = 6;
else if (month == "July")
monthInt = 7;
else if (month == "August")
monthInt = 8;
else if (month == "September")
monthInt = 9;
else if (month == "October")
monthInt = 10;
else if (month == "November")
monthInt = 11;
else if (month == "December")
monthInt = 12;
return monthInt;
}
int main () {
// TODO: Read dates from input, parse the dates to find the one
// in the correct format, and output in m/d/ format
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:00, michelle7511
Which database model is best used for data warehouse and data mining
Answers: 3
image
Computers and Technology, 23.06.2019 23:30, jamalchris9353
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
image
Computers and Technology, 24.06.2019 11:20, tiffanibell71
Colby works as a shipping clerk for a major package delivery service. some of his daily tasks include tracking shipments and entering orders. which aspect of the information technology cluster would he most likely be trained in? a. networkingb. databasesc. hardwared. software
Answers: 2
image
Computers and Technology, 25.06.2019 09:30, jhahn001
Which of the following is a reason to include the people who will be using the new technology in conversations about technology upgrades for a business? a. the users would likely know if an upgrade would be necessary or even useful. b. the users would know more about the software than people in the it department. c. the users will be paying for the upgrades with their own money. d. the users will assume the upgrade will cause a drop in productivity.
Answers: 1
Do you know the correct answer?
Complete main() to read dates from input, one date per line. Each date's format must be as follows:...

Questions in other subjects:

Konu
Law, 17.10.2021 09:30
Konu
Mathematics, 17.10.2021 09:30