1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mr Goodwill [35]
2 years ago
10

LAB: Parsing dates 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 LAB ACTIVITY 9.10.1: LAB: Parsing dates 0/10 main.cpp Load default template - COLE > 5 6 int DateParser(string month) 7 int monthInt = 0; if (month January) 10 monthint - 11 11 else if (month -- "February") 12 monthint - 21 13 else if (month - "March) montrent - 3; 15 else if (month -- "April") 16 monthInt - 4 else if (month "ay") monthint - 5 19 else if (month June") antin 6 21 else if (monthuly) 22 monthint - 7 else if (monthst") monthiet 8 LAB ACTIVITY 9.10.1: LAB: Parsing dates main.cpp 22 monthint - 1 23 else if (month == "August") 24 monthInt = 8; 25 else if (month - "September") 26 monthInt = 9; 27 else if (month -- "October") 28 monthInt - 10; 29 else if (month - "November") 30 monthInt - 11; 31 else if (month - "December") 32 monthInt = 12; 33 return monthint; 34 ) I 35 36 int main() { 37 38 // TODO: Read dates from input, parse the dates to find the one 39 1 in the correct format, and output in m/d/yyyy format 40 41) 42
Computers and Technology
1 answer:
Vladimir [108]2 years ago
6 0

The python code which can be used to read dates from input, one date per line and each date's format must be as follows: March 1, 1990, is:

<h3>Python code</h3>

import datetime

inputs = []

result = []

#read the inputs

date = input()

inputs.append(date)

while not date == "-1":

 date = input()

 inputs.append(date)

#check if the input is in the correct format and convert it.

for date_text in inputs:

 try:

   date_text = datetime.datetime.strptime(date_text,"%d %B, %Y")

   result.append(date_text.strftime("%d/%m/%Y"))

 except ValueError:

   pass

   

print(*result, sep = "\n")

The above code would parse the string and extract the date. The split() method was used to break the input into tokens.

Read more about python programming here:

brainly.com/question/27666303

#SPJ1

You might be interested in
Myles is studying a system to lessen the number of complaints about the Help Desk. He has formally studied the service counter a
olga55 [171]

Answer: Informal bench-marking

Explanation:

Informal bench-marking is defined as unconscious comparison of one's own behavior, skills, values etc with other and learning from them to improve. This leaning can be found in work-place, home, school etc.

  • According to the question, Myles is using informal bench-marking through studying other stores complaint handling style and reduction technique so that he can learn from it.
  • Other options are incorrect because designing analysis,outcome analysis, issue analysis and processing of complaining ta re not the comparison that unconsciously done by person .
  • Thus, the correct option is informal bench- marking.
4 0
3 years ago
Hotels and motels that are part of a ________ share a centralized reservation system and a common image, logo or advertising slo
hoa [83]
It is company , I think .
8 0
3 years ago
When you enable user access control (uac)
SVEN [57.7K]
The UAC is on by default. So, you don't need to turn it on unless someone else turned it off.

The UAC has four modes.

The lowest mode is the off position. If the UAC is off, no UAC prompt will pop up when doing administrative tasks.

6 0
3 years ago
Power point 2016 which chart element provides the boundaries of the graphic?
SVEN [57.7K]
D. (chart elemments) - correct answer
8 0
3 years ago
What can you say about the different website that you used? do they have in common?​
Harrizon [31]
They all have ads. Some have inappropriate ads while some have irrelevant ads with respect to the website your on.
8 0
2 years ago
Other questions:
  • A customer has contacted you to help him alleviate the large amount of time and effort that goes into adding and removing users
    12·1 answer
  • Jim wants to develop an app for a specific purpose that would run even when his computer is not connected to the Internet. What
    11·1 answer
  • To add text to a slide when using presentation software, you need to add a text box. To add a text box, click the Text Box butto
    6·2 answers
  • I need a free flashdrive can anyone tell me any website links so i can get one for free????​
    11·1 answer
  • ____ is the only automated disk-to-disk tool that allows you to copy data to a slightly smaller target drive than the original s
    5·1 answer
  • Rainfall_mi is a string that contains the average number of inches of rainfall in Michigan for every month (in inches) with ever
    12·1 answer
  • BEING TIMED HELP ASAP
    12·2 answers
  • I need help!! I decided to go back to college this year and am taking Intro to Logic and Programming. I have an assignment due t
    5·1 answer
  • What is a web browser​
    9·1 answer
  • A(n) _____ is a local connection point-of-presence that connects a variety of high-performance networks, and its main function i
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!