Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Directions: Rewrite the program from the lesson by using Cstrings instead of the C++ string class. Do NOT not use the string header; use the

Directions: Rewrite the program from the lesson by using Cstrings instead of the C++ string class. Do NOT not use the string header; use the cstring header instead. Create and use the functions described below to extract the length, location of w, year, customer number and order number from the workorder.

image text in transcribed

Requirements: 1. Main program a. Output instructions to the user to enter the work order in the appropriate format: i. First 56 digits represent the customer number followed by the letter w ii. The digits following the letter w represent the year iii. The remaining digits (up to 5) represent the order number b. Input the work order into a char array of size 20 c. Breakdown the work order by calling the functions described below d. Output the components of the work order i. Length ii. Location of the letter w iii. Customer number iv. Year v. Order number 2. Create and use the following functions to break out the components of the work order: a. Builtin function strlen (workOrder) i. Returns the length of the char array b. int findW (char[], int); i. Searches the workOrder to find the location of the letter w ii. Returns the array location of the letter w c. long getCustNum (char[], int); i. Transfers the characters in the work order prior to the letter w into a local customer number character array ii. Converts the local customer number character array to type long iii. Returns the long value of the customer number d. int getYear (char[], int); i. Returns the two digist following the letter w as type int e. long getOrderNum (char[], int, int); i. Transfers the characters in the work order following the letter w into a local char array ii. Converts the local char array to type long iii. Returns the long value

include #include using namespace std; /eed this if working with string class Bint main() int strLength, wPointer; string custNumber, year, workOrder Number; string workOrder - "91800940770"; strLength workorder.length(); wPointer - workOrder.find('W',e); //remember the first digit in the string is a custNumber.assign(workOrder, e, WPointer); //extracting the customer number year.assign(workorder, wPointer + 1, 2); //the year is the two digits after the w workOrder Number.assign (workOrder, Pointer + 3, strLength); //extracting the work order number cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions