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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started