Cstring problems errors

  • Thread starter Thread starter Brian Holcer
  • Start date Start date
B

Brian Holcer

Guest
#include <cstdlib>
#include <iostream>
#include<cstring>
using namespace std;
int strlen(char[], int);
int findW(char[], int);
long getCustNum(char[], int);
int getYear(char[], int);
long getOrderNum(char[], int, int);


int main()
{
int strLength,wPointer;
string custNumber, year, workOrderNumber;
int const SIZE = 20;
string workOrder[SIZE] = { "91800w940770" };

strLength = strlen(workOrder, SIZE);
cout << "The length of the character array is ;" << strLength << endl;

wPointer = findW(workOrder, SIZE);
cout << "The location of the w is: " << wPointer << endl;

custNumber = getCustNum(workOrder, SIZE);
cout << "The customer number is ;" << custNumber << endl;

year = getYear(workOrder, SIZE);
cout << "The year of the order is: " << year << endl;

workOrderNumber = getOrderNum(workOrder, SIZE);
cout << "The order number is :" << workOrderNumber << endl;

system("pause");
return 0;


}
int findW(char array, int size)
{
int wPointer = workOrder.find('w');
return wPointer;
}
long getCustNum(char array, int size)
{
string custNbr = array.substr(0, 4);
long custNumber = atol("98100");
return custNumber;

}
int getYear(char workOrder, int size)
{
string yr=workOrder.substr(6, 7);
int year = atoi("94");
return year;

}
long getOrderNum(char workOrder, int size)
{
string orderNum = workOrder.substr(8, 11);
long workOrderNumber = atol("0770");
return workOrderNumber;

}


Trying to create a program to extract from a string various characters and I am getter errors when I tried to create the functions like no instance of overloaded function matches argument list, expression must have class type, and no operator matches these operands. What do I need to change?

Thanks,

Continue reading...
 
Back
Top