Question: 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

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.

Program needing to be rewriten.

int main()

{

int strLength, wPointer;

string custNumber, year, workOrderNumber;

string workOrder="91800w940770";

strLength= workOrder.length();

wPointer=workOrder.fnd('w',0);

custNumber.assign(workOrde, 0, wPointer);

year.assign(workOrder, wPointer +1, 2);

workOrderNumber.assign(workOrder, wPointer +3, strLength);

cout<<"The length is " <

cout<<"The location of the w is " <

cout<<"The customer nmber is "<

cout<<"The order number is "<

system("pause");

return 0;

}

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);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!