I really don't know where to start and to be honest I really don't know what I'm doing. I was given this project and we never went over these topics in class or the previous class. My attempts to wing it are not going so well and quite frankly its embarrassing. The program should be divided in its respective header and implementation files, but I am just trying to get the code to work. I can divide the code up later. I still need to write one more class which is the entire collection of DVD's. The c-string class is a re-definition of c-strings that I have to implement. The DVD class is attributes of a DVD in the collection. If anyone could please at the very least guide me in the right direction I would really appreciate it.

#include <iostream>
using std::istream;
using std::ostream;

clas string
{
	private:
		char _string[];
		//recursive functions
		int str_length(const char str[]);
		int str_compare(const char *str1, const char *str2);
		void str_reverse(char str[] , int length);
		bool str_replace_first(char str[], const char find[], const char replace[]);
		
		//iterative functions
		int length_iter(const char str[]);
		int str_compare_iter(char str1[], const char str2[]);
		void str_reverse_iter(char str[], int length);
		bool str_replace_first_iter(char str[], const char find[], const char replace[]);
	
	public:
		//Constructors
		string();
		string(char *array, int size);
		//Deconstructor
		~string();
		
		int str_length(){
			return str_length(_string);}
		int str_compare(){
			return str_compare(_string, _string);}
		void str_reverse(){
			return str_reverse(_string, str_length(_string));}
		bool str_replace_first(){
			return str_replace_first(_string, _string, _string);}
			
		int length_iter(){
			return str_length(_string);}
		int str_compare_iter(){
			return str_compare(_string, _string);}
		void str_reverse_iter(){
			return str_reverse(_string, str_length(_string));}
		bool str_replace_first_iter(){
			return str_replace_first(_string, _string, _string);}
		//Overloaded Operators
		void operator+(string &rstring);
		friend std::istream &operator >>(std::istream &is, string &string);
		friend std::ostream &operator <<(std::ostream &os, string &string);
		
	string::string()
{
	_string = new char[100];
	_string[0] = '\0';
}

string::string(char *array, int size)
{
	_string = new char[size];
	for(int i=0; i < size; i++)
	{
        _string = *array;
	}
}
//Deconstructor
string::~string()
{
	delete [] _string;
}
/**
 * This function finds the length of a c-string using recursion
 * @param str[ ] a c-string variable that stores a string from user
 * @pre  in main command = "length", str[0] is not an empty string-'\0'
 * @post if str[0]='\0' then 0 is returned or str_length is called again but at the next index of str[]
 * @return the length of the c-string str[]
 */
int string::str_length(const char str[])
{
	//base case
	if (str[0] == '\0')
		return 0;
	//recursive statement
	else
		return 1 + str_length(str+1);
}

/**
 * This function finds the length of a c-string using iteration
 * @param str[ ] a c-string variable that stores a string from user
 * @pre in main command = "length_iter", str[ ] is not an empty string-'\0'
 * @post i is < 0
 * @return the length of the c-string str[]
 */
int string::length_iter(const char str[])
{
	int i=0;
	while(str[i] != '\0')
	{
		i++;
	}
	return i;
}

/**
 * This recursive function compares 2 c-strings to see if they are equal or there is a character mismatch
 * @param *str1 is a pointer to charArray[ ]
 * @param *str2 is a pointer to scharArray2[ ]
 * @pre in main command = "compare", str1[ ] and str2[ ] is not an empty string-'\0'
 * @post str1[] and str2[ ] are equal or *str1 and *str2 point to different characters
 * @return a integer vaule that is the distance between the ASCII character vaules.  If *str1 points to
a smaller character, the vaule is negative.  If *str2 points to the a smaller character the value is positive.
If both *str1 and *str2 do not point to a mismatch, then str1[ ] and str2[ ] are equal and 0 is returned 
 */	
int string::str_compare(const char *str1, const char *str2)
{
    if (*str1 != '\0' || *str2 != '\0')
    {
        if (*str1 != *str2)
        {
            if (*str1 > *str2)
            {
                return *str1 - *str2;
            }
            else if (*str1 < *str2)
            {
                return *str1 - *str2;
            }
        }
        
    }
    else return 0; //C-strings are equal-base case
    //recursive statement
    return str_compare(str1 + 1, str2 + 1);
}	

/**
 * This iterative function compares 2 c-strings to see if they are equal or there is a character mismatch
 * @param str1[ ] is a c-string variable that stores a string from user
 * @param str2[ ] is a c-string variable that stores a string from user
 * @pre in main command = "compare_iter", str1[ ] and str2[ ]  are not an empty string-'\0'
 * @post str1[] and str2[ ] are equal or str1[i]  and str2[i]  contain different characters
 * @return a integer vaule(diff) that is the distance between the ASCII character vaules.  If str1[i] contains
a smaller character, the vaule(diff) is negative.  If str2[i] contains the a smaller character the value(diff) is positive.
If both str1[i]  and str2[i]  do not contain a mismatch, then str1[ ] and str2[ ] are equal and 0 is returned (diff)
*/
int string::str_compare_iter(char str1[], const char str2[])
{
	for( ; *str1=*str2; *str1++, str2++)
	{
	     if(*str1 == 0)
            return 0;
	}
   
	return int(*str1-*str2); 
}

/**
 * This recursive function will reverse the c-string str
 * @param *str is a pointer to charArray[ ]
 * @param length is the length of charArray[ ]
 * @pre in main command = "reverse", *str does notpoint to an empty string-'\0'
 * @post the string in charArray[ ]  is reversed
 * @return no return value
 */
void string::str_reverse(char *str, int length)
{
	
	char temp, temp1;
    	
    if (length >= 1)
    {
         // swap first & last chars    
         temp = str[0];
         str[0] = str[length-1];
         str[length-1] = temp; 
         // recursive call--
         str_reverse(&str[1], length-2);
    }
}    

/**
 * * This recursive function will reverse the c-string str
 * @param str[ ] str1[ ] is a c-string variable that stores a string from charArray[ ]
 * @param length is the length of charArray[ ]
 * @pre in main command = "reverse_iter", str[ ]  does notpoint to an empty string-'\0'
 * @post the string in charArray[ ]  is reversed
 * @return no return value
 */	
void string::str_reverse_iter(char str[], int length)
{
	char temp;
	int starti, endi, mid;//starting and ending index
	starti = 0;
	endi = length - 1;
	mid = length / 2;
	
	while(starti < mid)
	{
		temp = str[starti];
		str[starti] = str[endi-starti];
		str[endi-starti] = temp;
		starti++;
	}
}

/**
 * This recursive function will search a c-string for a character(s) to be replaced with other character(s)
 * @param *str points to charArray[ ] the array to be searched
 * @param *find points to charArray2[ ], contains what to search for
 * @param*replace points to charArray3[ ] what to replace the characters with
 * @param is_partial_match  is true if part of the find string is found in the original string
 * @pre  in main command = "replace_first", *str[ ] , *find, *replace does nont point to an empty string-'\0'
 * @post Either the string was found and replaced in the array or *find and *replace were not equal in size thus the array was not searched
 * @return false condition if *find and *replace were not equal in size thus the array was not searched or
 true condition if *find and *replace were equal in size thus the array was searched and replaced with the contents *replace points to
 */
bool string::str_replace_first(char *str, const char *find, const char *replace)
{
	if(length_iter(find) != length_iter(replace))
	{
		cout << "ERROR: The find and replace strings are of different length." << endl;
		cout << "Please change the find and replace strings to the same length." << endl;
		return false;
	}
	
	while(*str != '\0')
    {        
            
    if(*str == *find)
		{
			*str = *replace;
			*replace++;
			*find++;
        }

	else	str_replace_first(str+1, find, replace);
}
    return true;
}

/**
 * This iteraive function will search a c-string for a character(s) to be replaced with other character(s)
 * @param str points to charArray[ ] the array to be searched
 * @param find points to charArray2[ ], contains what to search for
 * @param replace points to charArray3[ ] what to replace the characters with
  * @param is_partial_match  is true if part of the find string is found in the original string
 * @pre  in main command = "replace_first_iter", str , find, replace does nont point to an empty string-'\0'
 * @post Either the string was found and replaced in the array or find and replace were not equal in size thus the array was not searched
 * @return false condition if find and replace were not equal in size thus the array was not searched or
 true condition if find and replace were equal in size thus the array was searched and replaced with the contents replace points to
 */
bool string::str_replace_first_iter(char str[], const char find[], const char replace[])
{
	if(length_iter(find) != length_iter(replace))
	{
		cout << "ERROR: The find and replace strings are of different length." << endl;
		cout << "Please change the find and replace strings to the same length." << endl;
		return false;
	}
	int i, j, k, m, n, delta;
    int n1, n2, n3;
    char* p, *q;
    if (!str || !find)
        return 0;
    if (!replace)
        replace = "";
    n1 = str_length(str);
    n2 = str_length(find);
    n = n1 - n2 + 1;
    for (i = 0; i < n; ++i)
    {
        for (j = 0; j < n2 && find[j] == str[i+j]; ++j)
            ;
        if (j == n2) // found
        {
            n3 = str_length(replace);
            delta = n3 - n2;
            m = n1 - i - n2;
            if (delta < 0) /* move left */
            {
                p = str + (i + n2 + delta);
                q = p - delta;
                for (k = 0; k <= m; ++k)
                    p[k] = q[k];
            }
            else if (delta > 0) /* move right */
            {
                q = str + n1 - m;
                p = q + delta;
                for (k = m; k >= 0; --k)
                    p[k] = q[k];
            }
            for (k = 0; k < n3; ++k)
                str[i+k] = replace[k];
            return str + i + n3;
        }
    }
    return 0;
}

int string::str_length(){
	return str_length(_string);}

int string::str_compare(){
	return str_compare(_string, _string);}

void string::str_reverse(){
	return str_reverse(_string, str_length(_string));}

bool string::str_replace_first(){
	return str_replace_first(_string, _string, _string);}

int string::length_iter(){
	return str_length(_string);}

int string::str_compare_iter(){
	return str_compare(_string, _string);}

void string::str_reverse_iter(){
	return str_reverse(_string, str_length(_string));}

bool string::str_replace_first_iter(){
	return str_replace_first(_string, _string, _string);}
	
void string::operator+(string &rstring)
{
	//string temp;
	int len = str_length(_string) + str_length(rstring);
    string temp(_string, len);
    int i;
    for (i = 0; i < str_length(_string); i++)
         temp[i] = _string[i];
    for (int j = 0; j < str_length(rstring); j++, i++)
        temp[i] = rstring[j];
    //rstring[len]='\0';
}

istream &operator >>(std::istream &is, string &string)
{
	for(int i = 0; i < str_length(string); i++)
		is >> string[i];
}

ostream &operator <<(std::ostream &os, string &string)
{
	for(int i = 0; i < str_length(string); i++)
		os << string[i];
	return os;
}
};

namespace string
{
	clas DVD : public string
	{
		private:
			string actor, title, descrip;
			int year;
		
		public:
			DVD();
			DVD(string actor, string title, string descrip, int year);
			friend std::ostream& operator <<(std::ostream &os, DVD &DVD);

	DVD()
	{
    
	}

	DVD(string actor, string title, string descrip, int year):string(actor, str_length(actor)), 
		string(title, str_length(title)), string(descrip, str_length(descrip)), year =0)
	{

	}

	friend std::istream& operator >>(std::istream &is, DVD &DVD)
	{
		is.getline(actor, 100);
		is.getline(album, 100);
		is >> year;
		is.getline(descrip, 100);
		do
		{
			is.getline(descrip, 100);
		} while(descrip != 'END');
		return is;
	}
	}
};

int main(){
    DVD one;
    one.actor >> "The Cure";
    one.title >> "Boys Don't Cry";
    one.year >> 1985;
    one.descrip >> "The best.";
    return 0;
}

Compile errors:

test.cpp:51: error: `SString::SString()' and `SString::SString()' cannot be overloaded

 test.cpp:57: error: `SString::SString(char*, int)' and `SString::SString(char*, int)' cannot be overloaded
 test.cpp:66: error: `SString::~SString()' and `SString::~SString()' cannot be overloaded
 test.cpp:77: error: `int SString::str_length(const char*)' and `int SString::str_length(const char*)' cannot be overloaded
 test.cpp:94: error: `int SString::length_iter(const char*)' and `int SString::length_iter(const char*)' cannot be overloaded

 test.cpp:114: error: `int SString::str_compare(const char*, const char*)' and `int SString::str_compare(const char*, const char*)' cannot be overloaded
 test.cpp:146: error: `int SString::str_compare_iter(char*, const char*)' and `int SString::str_compare_iter(char*, const char*)' cannot be overloaded

 test.cpp:165: error: `void SString::str_reverse(char*, int)' and `void SString::str_reverse(char*, int)' cannot be overloaded
 test.cpp:189: error: `void SString::str_reverse_iter(char*, int)' and `void SString::str_reverse_iter(char*, int)' cannot be overloaded
 test.cpp:217: error: `bool SString::str_replace_first(char*, const char*, const char*)' and `bool SString::str_replace_first(char*, const char*, const char*)' cannot be overloaded
 test.cpp:252: error: `bool SString::str_replace_first_iter(char*, const char*, const char*)' and `bool SString::str_replace_first_iter(char*, const char*, const char*)' cannot be overloaded
 test.cpp:300: error: `int SString::str_length()' and `int SString::str_length()' cannot be overloaded
 test.cpp:303: error: `int SString::str_compare()' and `int SString::str_compare()' cannot be overloaded
 test.cpp:306: error: `void SString::str_reverse()' and `void SString::str_reverse()' cannot be overloaded
 test.cpp:309: error: `bool SString::str_replace_first()' and `bool SString::str_replace_first()' cannot be overloaded
 test.cpp:312: error: `int SString::length_iter()' and `int SString::length_iter()' cannot be overloaded
 test.cpp:315: error: `int SString::str_compare_iter()' and `int SString::str_compare_iter()' cannot be overloaded
 test.cpp:318: error: `void SString::str_reverse_iter()' and `void SString::str_reverse_iter()' cannot be overloaded
 test.cpp:321: error: `bool SString::str_replace_first_iter()' and `bool SString::str_replace_first_iter()' cannot be overloaded

 test.cpp:325: error: `void SString::operator+(SString&)' and `void SString::operator+(SString&)' cannot be overloaded
 test.cpp:338: error: `std::istream& SString::operator>>(std::istream&, SString&)' must take exactly one argument
 test.cpp:344: error: `std::ostream& SString::operator<<(std::ostream&, SString&)' must take exactly one argument
 test.cpp: In constructor `SString::SString()':
 test.cpp:52: error: incompatible types in assignment of `char*' to `char[0u]'
 test.cpp: In constructor `SString::SString(char*, int)':
 test.cpp:58: error: incompatible types in assignment of `char*' to `char[0u]'
 test.cpp:61: error: incompatible types in assignment of `char' to `char[0u]'

 test.cpp: In member function `bool SString::str_replace_first(char*, const char*, const char*)':
 test.cpp:220: error: `cout' undeclared (first use this function)
 test.cpp:220: error: (Each undeclared identifier is reported only once for each function it appears in.)
 test.cpp:220: error: `endl' undeclared (first use this function)

 test.cpp: In member function `bool SString::str_replace_first_iter(char*, const char*, const char*)':
 test.cpp:255: error: `cout' undeclared (first use this function)
 test.cpp:255: error: `endl' undeclared (first use this function)

 test.cpp: In member function `void SString::operator+(SString&)':
 test.cpp:327: error: no matching function for call to `SString::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:331: error: no match for 'operator[]' in 'temp[i]'
 test.cpp:332: error: no matching function for call to `SString::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:333: error: no match for 'operator[]' in 'temp[i]'
 test.cpp:333: error: no match for 'operator[]' in 'rstring[j]'
 test.cpp: In member function `std::istream& SString::operator>>(std::istream&, SString&)':
 test.cpp:339: error: no matching function for call to `SString::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:340: error: no match for 'operator[]' in 'string[i]'
 test.cpp: In member function `std::ostream& SString::operator<<(std::ostream&, SString&)':
 test.cpp:345: error: no matching function for call to `SString::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:346: error: no match for 'operator[]' in 'string[i]'
 test.cpp: At global scope:
 test.cpp:365: error: `SString::CD::CD()' and `SString::CD::CD()' cannot be overloaded
 test.cpp:369: error: `SString::CD::CD(SString, SString, SString, int)' and `SString::CD::CD(SString, SString, SString, int)' cannot be overloaded
 test.cpp:384:22: warning: multi-character character constant
 test.cpp: In constructor `SString::CD::CD(SString, SString, SString, int)':
 test.cpp:369: error: no matching function for call to `SString::CD::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:370: error: no matching function for call to `SString::CD::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:370: error: no matching function for call to `SString::CD::str_length(SString&)'
 test.cpp:10: note: candidates are: int SString::str_length(const char*)
 test.cpp:28: note:                 int SString::str_length()
 test.cpp:370: error: expected `(' before '=' token
 test.cpp:370: error: multiple initializations given for base `SString'
 test.cpp:370: error: multiple initializations given for base `SString'

 test.cpp:370: error: expected `{' before '=' token

 test.cpp: In function `std::istream& SString::operator>>(std::istream&, SString::CD&)':
 test.cpp:356: error: invalid use of non-static data member `SString::CD::artist'
 test.cpp:377: error: from this location
 test.cpp:378: error: `album' undeclared (first use this function)
 test.cpp:357: error: invalid use of non-static data member `SString::CD::year'
 test.cpp:379: error: from this location

 test.cpp:356: error: invalid use of non-static data member `SString::CD::descrip'
 test.cpp:380: error: from this location
 test.cpp:356: error: invalid use of non-static data member `SString::CD::descrip'
 test.cpp:383: error: from this location
 test.cpp:356: error: invalid use of non-static data member `SString::CD::descrip'
 test.cpp:384: error: from this location
 test.cpp: At global scope:
 test.cpp:388: error: expected unqualified-id before '}' token
 test.cpp:388: error: expected `,' or `;' before '}' token
 test.cpp: In function `int main()':
 test.cpp:391: error: `CD' undeclared (first use this function)
 test.cpp:391: error: expected `;' before "one"
 test.cpp:392: error: `one' undeclared (first use this function)

Execution terminated

Recommended Answers

All 12 Replies

line 5: class is misspelled.

line 8: you must specify a length if you want to use a character array. If you want to use dynaming array allocation then use a pointer -- char* _string; line 49: you must end the class declaration with };

The constructor with two parameters should be this:

string::string(char *array, int size)
    {
             int i;
	    _string = new char[size+1]; // +1 for the string's null terminator character
	    for(i=0; i < size; i++)
	    {
            _string[i] = array[i];
	    }
        _string[i] = 0; // add string's null terminating character
    }

line 294: I don't know what you want to return here, but what you have coded isn't correct.

I did what was suggested, but still have some errors. As for line# 243, that function will not be used, but has to be declared. They just wanted to see if could follow syntax.

#include <iostream>
using std::istream;
using std::ostream;
using namespace std;

class SString
{
	private:
		char *_string;
		//recursive functions
		int str_length(const char str[]);
		int str_compare(const char *str1, const char *str2);
		void str_reverse(char str[] , int length);
		bool str_replace_first(char str[], const char find[], const char replace[]);
		
		//iterative functions
		int length_iter(const char str[]);
		int str_compare_iter(char str1[], const char str2[]);
		void str_reverse_iter(char str[], int length);
		bool str_replace_first_iter(char str[], const char find[], const char replace[]);
	
	public:
		//Constructors
		SString();
		SString(char *array, int size);
		//Deconstructor
		~SString();
		
		int str_length(){
			return str_length(_string);}
		int str_compare(){
			return str_compare(_string, _string);}
		void str_reverse(){
			return str_reverse(_string, str_length(_string));}
		bool str_replace_first(){
			return str_replace_first(_string, _string, _string);}
			
		int length_iter(){
			return str_length(_string);}
		int str_compare_iter(){
			return str_compare(_string, _string);}
		void str_reverse_iter(){
			return str_reverse(_string, str_length(_string));}
		bool str_replace_first_iter(){
			return str_replace_first(_string, _string, _string);}
		//Overloaded Operators
		void operator+(SString &rstring);
		friend std::istream &operator >>(std::istream &is, SString &string);
		friend std::ostream &operator <<(std::ostream &os, SString &string);
};		
SString::SString()
{
	_string = new char[100];
	_string[0] = '\0';
}

SString::SString(char *array, int size)
    {
        int i;
	    _string = new char[size+1]; // +1 for the string's null terminator character
	    for(i=0; i < size; i++)
	    {
            _string[i] = array[i];
	    }
        _string[i] = 0; // add string's null terminating character
    }
//Deconstructor
SString::~SString()
{
	delete [] _string;
}
/**
 * This function finds the length of a c-string using recursion
 * @param str[ ] a c-string variable that stores a string from user
 * @pre  in main command = "length", str[0] is not an empty string-'\0'
 * @post if str[0]='\0' then 0 is returned or str_length is called again but at the next index of str[]
 * @return the length of the c-string str[]
 */
int SString::str_length(const char str[])
{
	//base case
	if (str[0] == '\0')
		return 0;
	//recursive statement
	else
		return 1 + str_length(str+1);
}

/**
 * This function finds the length of a c-string using iteration
 * @param str[ ] a c-string variable that stores a string from user
 * @pre in main command = "length_iter", str[ ] is not an empty string-'\0'
 * @post i is < 0
 * @return the length of the c-string str[]
 */
int SString::length_iter(const char str[])
{
	int i=0;
	while(str[i] != '\0')
	{
		i++;
	}
	return i;
}

/**
 * This recursive function compares 2 c-strings to see if they are equal or there is a character mismatch
 * @param *str1 is a pointer to charArray[ ]
 * @param *str2 is a pointer to scharArray2[ ]
 * @pre in main command = "compare", str1[ ] and str2[ ] is not an empty string-'\0'
 * @post str1[] and str2[ ] are equal or *str1 and *str2 point to different characters
 * @return a integer vaule that is the distance between the ASCII character vaules.  If *str1 points to
a smaller character, the vaule is negative.  If *str2 points to the a smaller character the value is positive.
If both *str1 and *str2 do not point to a mismatch, then str1[ ] and str2[ ] are equal and 0 is returned 
 */	
int SString::str_compare(const char *str1, const char *str2)
{
    if (*str1 != '\0' || *str2 != '\0')
    {
        if (*str1 != *str2)
        {
            if (*str1 > *str2)
            {
                return *str1 - *str2;
            }
            else if (*str1 < *str2)
            {
                return *str1 - *str2;
            }
        }
        
    }
    else return 0; //C-strings are equal-base case
    //recursive statement
    return str_compare(str1 + 1, str2 + 1);
}	

/**
 * This iterative function compares 2 c-strings to see if they are equal or there is a character mismatch
 * @param str1[ ] is a c-string variable that stores a string from user
 * @param str2[ ] is a c-string variable that stores a string from user
 * @pre in main command = "compare_iter", str1[ ] and str2[ ]  are not an empty string-'\0'
 * @post str1[] and str2[ ] are equal or str1[i]  and str2[i]  contain different characters
 * @return a integer vaule(diff) that is the distance between the ASCII character vaules.  If str1[i] contains
a smaller character, the vaule(diff) is negative.  If str2[i] contains the a smaller character the value(diff) is positive.
If both str1[i]  and str2[i]  do not contain a mismatch, then str1[ ] and str2[ ] are equal and 0 is returned (diff)
*/
int SString::str_compare_iter(char str1[], const char str2[])
{
	for( ; *str1=*str2; *str1++, str2++)
	{
	     if(*str1 == 0)
            return 0;
	}
   
	return int(*str1-*str2); 
}

/**
 * This recursive function will reverse the c-string str
 * @param *str is a pointer to charArray[ ]
 * @param length is the length of charArray[ ]
 * @pre in main command = "reverse", *str does notpoint to an empty string-'\0'
 * @post the string in charArray[ ]  is reversed
 * @return no return value
 */
void SString::str_reverse(char *str, int length)
{
	
	char temp, temp1;
    	
    if (length >= 1)
    {
         // swap first & last chars    
         temp = str[0];
         str[0] = str[length-1];
         str[length-1] = temp; 
         // recursive call--
         str_reverse(&str[1], length-2);
    }
}    

/**
 * * This recursive function will reverse the c-string str
 * @param str[ ] str1[ ] is a c-string variable that stores a string from charArray[ ]
 * @param length is the length of charArray[ ]
 * @pre in main command = "reverse_iter", str[ ]  does notpoint to an empty string-'\0'
 * @post the string in charArray[ ]  is reversed
 * @return no return value
 */	
void SString::str_reverse_iter(char str[], int length)
{
	char temp;
	int starti, endi, mid;//starting and ending index
	starti = 0;
	endi = length - 1;
	mid = length / 2;
	
	while(starti < mid)
	{
		temp = str[starti];
		str[starti] = str[endi-starti];
		str[endi-starti] = temp;
		starti++;
	}
}

/**
 * This recursive function will search a c-string for a character(s) to be replaced with other character(s)
 * @param *str points to charArray[ ] the array to be searched
 * @param *find points to charArray2[ ], contains what to search for
 * @param*replace points to charArray3[ ] what to replace the characters with
 * @param is_partial_match  is true if part of the find string is found in the original string
 * @pre  in main command = "replace_first", *str[ ] , *find, *replace does nont point to an empty string-'\0'
 * @post Either the string was found and replaced in the array or *find and *replace were not equal in size thus the array was not searched
 * @return false condition if *find and *replace were not equal in size thus the array was not searched or
 true condition if *find and *replace were equal in size thus the array was searched and replaced with the contents *replace points to
 */
bool SString::str_replace_first(char *str, const char *find, const char *replace)
{
	if(length_iter(find) != length_iter(replace))
	{
		cout << "ERROR: The find and replace strings are of different length." << endl;
		cout << "Please change the find and replace strings to the same length." << endl;
		return false;
	}
	
	while(*str != '\0')
    {        
            
    if(*str == *find)
		{
			*str = *replace;
			*replace++;
			*find++;
        }

	else	str_replace_first(str+1, find, replace);
}
    return true;
}

/**
 * This iteraive function will search a c-string for a character(s) to be replaced with other character(s)
 * @param str points to charArray[ ] the array to be searched
 * @param find points to charArray2[ ], contains what to search for
 * @param replace points to charArray3[ ] what to replace the characters with
  * @param is_partial_match  is true if part of the find string is found in the original string
 * @pre  in main command = "replace_first_iter", str , find, replace does nont point to an empty string-'\0'
 * @post Either the string was found and replaced in the array or find and replace were not equal in size thus the array was not searched
 * @return false condition if find and replace were not equal in size thus the array was not searched or
 true condition if find and replace were equal in size thus the array was searched and replaced with the contents replace points to
 */
bool SString::str_replace_first_iter(char str[], const char find[], const char replace[])
{
	if(length_iter(find) != length_iter(replace))
	{
		cout << "ERROR: The find and replace strings are of different length." << endl;
		cout << "Please change the find and replace strings to the same length." << endl;
		return false;
	}
	int i, j, k, m, n, delta;
    int n1, n2, n3;
    char* p, *q;
    if (!str || !find)
        return 0;
    if (!replace)
        replace = "";
    n1 = str_length(str);
    n2 = str_length(find);
    n = n1 - n2 + 1;
    for (i = 0; i < n; ++i)
    {
        for (j = 0; j < n2 && find[j] == str[i+j]; ++j)
            ;
        if (j == n2) // found
        {
            n3 = str_length(replace);
            delta = n3 - n2;
            m = n1 - i - n2;
            if (delta < 0) /* move left */
            {
                p = str + (i + n2 + delta);
                q = p - delta;
                for (k = 0; k <= m; ++k)
                    p[k] = q[k];
            }
            else if (delta > 0) /* move right */
            {
                q = str + n1 - m;
                p = q + delta;
                for (k = m; k >= 0; --k)
                    p[k] = q[k];
            }
            for (k = 0; k < n3; ++k)
                str[i+k] = replace[k];
            return str + i + n3;
        }
    }
    return 0;
}

int SString::str_length(){
	return str_length(_string);}

int SString::str_compare(){
	return str_compare(_string, _string);}

void SString::str_reverse(){
	return str_reverse(_string, str_length(_string));}

bool SString::str_replace_first(){
	return str_replace_first(_string, _string, _string);}

int SString::length_iter(){
	return str_length(_string);}

int SString::str_compare_iter(){
	return str_compare(_string, _string);}

void SString::str_reverse_iter(){
	return str_reverse(_string, str_length(_string));}

bool SString::str_replace_first_iter(){
	return str_replace_first(_string, _string, _string);}

void SString::operator+(SString &rstring)
{
	//SString temp;
	int len = str_length(_string) + str_length(rstring);
    SString temp(_string, len);
    int i;
    for (i = 0; i < str_length(_string); i++)
         temp[i] = _string[i];
    for (int j = 0; j < str_length(rstring); j++, i++)
        temp[i] = rstring[j];
    //rstring[len]='\0';
}

istream &operator >>(std::istream &is, SString &string)
{
	for(int i = 0; i < str_length(string); i++)
		is >> string[i];
}

ostream &operator <<(std::ostream &os, SString &string)
{
	for(int i = 0; i < str_length(string); i++)
		os << string[i];
	return os;
}

namespace SString
{
	class CD : public SString
	{
		private:
			SString artist, title, descrip;
			int year;
		
		public:
			CD();
			CD(SString artist, SString title, SString descrip, int year);
			friend std::ostream& operator <<(std::ostream &os, CD &cd);
};
	CD()
	{
    
	}

	CD(SString artist, SString title, SString descrip, int year):SString(artist, str_length(artist)), 
		SString(title, str_length(title)), SString(descrip, str_length(descrip)), year =0)
	{

	}

	friend std::istream& operator >>(std::istream &is, CD &cd)
	{
		is.getline(artist, 100);
		is.getline(album, 100);
		is >> year;
		is.getline(descrip, 100);
		do
		{
			is.getline(descrip, 100);
		} while(descrip != 'END');
		return is;
	}
	}


int main(){
    CD one;
    one.artist >> "The Cure";
    one.title >> "Boys Don't Cry";
    one.year >> 1985;
    one.descrip >> "The best.";
    return 0;
}

Errors:

test.cpp: In member function `void SString::operator+(SString&)':
 test.cpp:330: error: no matching function for call to `SString::str_length(SString&)'
 test.cpp:80: note: candidates are: int SString::str_length(const char*)
 test.cpp:29: note:                 int SString::str_length()

 test.cpp:334: error: no match for 'operator[]' in 'temp[i]'
 test.cpp:335: error: no matching function for call to `SString::str_length(SString&)'
 test.cpp:80: note: candidates are: int SString::str_length(const char*)
 test.cpp:29: note:                 int SString::str_length()
 test.cpp:336: error: no match for 'operator[]' in 'temp[i]'

 test.cpp:336: error: no match for 'operator[]' in 'rstring[j]'
 test.cpp: In function `std::istream& operator>>(std::istream&, SString&)':
 test.cpp:342: error: `str_length' undeclared (first use this function)
 test.cpp:342: error: (Each undeclared identifier is reported only once for each function it appears in.)
 test.cpp:343: error: no match for 'operator[]' in 'string[i]'
 test.cpp: In function `std::ostream& operator<<(std::ostream&, SString&)':
 test.cpp:348: error: `str_length' undeclared (first use this function)
 test.cpp:349: error: no match for 'operator[]' in 'string[i]'

 test.cpp: At global scope:
 test.cpp:366: error: expected unqualified-id before ')' token
 test.cpp:367: error: expected `,' or `;' before '{' token
 test.cpp:371: error: expected `)' before "artist"
 test.cpp:371: error: expected `,' or `;' before "artist"
 test.cpp:378: error: can't initialize friend function `operator>>'
 test.cpp:378: error: friend declaration not in class definition

 test.cpp: In function `std::istream& SString::operator>>(std::istream&, SString::CD&)':
 test.cpp:379: error: `artist' undeclared (first use this function)
 test.cpp:380: error: `album' undeclared (first use this function)
 test.cpp:381: error: `year' undeclared (first use this function)
 test.cpp:382: error: `descrip' undeclared (first use this function)
 test.cpp:386:22: warning: multi-character character constant
 test.cpp: In function `int main()':
 test.cpp:393: error: `CD' undeclared (first use this function)
 test.cpp:393: error: expected `;' before "one"
 test.cpp:394: error: `one' undeclared (first use this function)

Execution terminated

That first error is telling you that SString class does not have a constructor that takes a SString object by reference. You will probably have to either add one, or change line 330 like this: int len = str_length(_string) + str_length(rstring._string);

Well, I wanted to say thank for your help, but I'm throwing in the towel. This program requires a skill set that unfortunately I do not possess. I could complain that the project gets into topics that were never covered in this or my previous class, but that doesn't get the job done. Its a weed out class anyway, so they succeeded.

Was there a prerequisit for that class? Have you taken those presequisite classes? Have you read the chapter(s) in your textbook? Maybe you need to start with a project a lot simpler so that you can learn the basics as you go along.

Well, I wanted to say thank for your help, but I'm throwing in the towel. This program requires a skill set that unfortunately I do not possess. I could complain that the project gets into topics that were never covered in this or my previous class, but that doesn't get the job done. Its a weed out class anyway, so they succeeded.

Oh don't give up now; you look like you're really close. I'd say there's plenty more weedy students in your class than you.

A lot of the compiler errors are duplicate function definition: it means that you've defined the guts of the same function more than once. Also, the declarations (prototypes) go inside the class, and the definitions (the workings) generally go after.

So, as I see it, the class declaration should be

class SString
{
	private:
		char *_string;
		//recursive functions
		int str_length(const char str[]);
		int str_compare(const char *str1, const char *str2);
		void str_reverse(char str[] , int length);
		bool str_replace_first(char str[], const char find[], const char replace[]);

		//iterative functions
		int length_iter(const char str[]);
		int str_compare_iter(char str1[], const char str2[]);
		void str_reverse_iter(char str[], int length);
		bool str_replace_first_iter(char str[], const char find[], const char replace[]);

	public:
		//Constructors
		SString();
		SString(char *array, int size);
		//Deconstructor
		~SString();

		int str_length();
		int str_compare();
		void str_reverse();
		bool str_replace_first();

		int length_iter();
		int str_compare_iter();
		void str_reverse_iter();
		bool str_replace_first_iter();

		//Overloaded Operators
		void operator+(SString &rstring);
		friend std::istream &operator >>(std::istream &is, SString &string);
		friend std::ostream &operator <<(std::ostream &os, SString &string);
};

Try compiling again, there will be less errors. Note that the errors that are reported back to you _try_ to explain what's wrong - and gives you the line number, which should help point you in the direction of what's going on.

commented: Good advice. +7

This class is Programming II. So Programming I was the pre-req. In Prog I the last topic was more like an intro to classes. The chapter we just finished, was almost a review. The project is around Chapter 8. I tried to follow it but it seemed that I was missing a few chapters before that.

Suggest you re-study the first 8 chapters in your book. Many instructors don't teach directly from the book -- they expect you to read it.

Didn't see your post dougy83. I'll will give that a shot.

OK, so you're still in the game then, good on you.

There's a lot of mistakes in getting the length of an SString, you are writing e.g. str_length(rstring) , but the str_length fn is only defined for an input of 'char*'. May I suggest using e.g. rstring.length_iter() , as you've already written that function.

You try to use the SString::operator[] without defining it. Define it if you need it.

Also, in your CD constructor (you're missing 'CD::' in definition), you have incorrectly attempted to initialise the CD member variables (~line 371 in your post above). Use the name of the variable, and not the type of the variable. i.e.

CD::CD(SString _artist, SString _title, SString _descrip, int _year) : artist(&_artist[0], _artist.length_iter()),
		title(&_title[0], _title.length_iter()), descrip(&_descrip[0], _descrip.length_iter()), year(0)
	{}
test.cpp: In member function `void string::operator+(string&)':
test.cpp:327: error: no match for 'operator[]' in 'temp[i]'

test.cpp:329: error: no match for 'operator[]' in 'temp[i]'
test.cpp:329: error: no match for 'operator[]' in 'rstring[j]'
test.cpp: In function `std::istream& operator>>(std::istream&, string&)':
test.cpp:336: error: no match for 'operator[]' in 'string[i]'
test.cpp: In function `std::ostream& operator<<(std::ostream&, string&)':
test.cpp:342: error: no match for 'operator[]' in 'string[i]'
test.cpp: In constructor `string::CD::CD(string, string, string, int)':
test.cpp:364: error: no match for 'operator[]' in 'artist[0]'
test.cpp:365: error: no match for 'operator[]' in 'title[0]'
test.cpp:365: error: no match for 'operator[]' in 'descrip[0]'
test.cpp: At global scope:
test.cpp:371: error: can't initialize friend function `operator>>'
test.cpp:371: error: friend declaration not in class definition
test.cpp: In function `std::istream& string::operator>>(std::istream&, string::CD&)':
test.cpp:372: error: `artist' undeclared (first use this function)
test.cpp:372: error: (Each undeclared identifier is reported only once for each function it appears in.)
test.cpp:373: error: `album' undeclared (first use this function)

test.cpp:374: error: `year' undeclared (first use this function)
test.cpp:375: error: `descrip' undeclared (first use this function)
test.cpp:379:22: warning: multi-character character constant
test.cpp: In function `int main()':
test.cpp:386: error: `CD' undeclared (first use this function)
test.cpp:386: error: expected `;' before "one"
test.cpp:387: error: `one' undeclared (first use this function)

Execution terminated

New code:

#include <iostream>
using std::istream;
using std::ostream;
using namespace std;
 
class string
{
	private:
		char *_string;
		//recursive functions
		int str_length(const char str[]);
		int str_compare(const char *str1, const char *str2);
		void str_reverse(char str[] , int length);
		bool str_replace_first(char str[], const char find[], const char replace[]);

		//iterative functions
		int length_iter(const char str[]);
		int str_compare_iter(char str1[], const char str2[]);
		void str_reverse_iter(char str[], int length);
		bool str_replace_first_iter(char str[], const char find[], const char replace[]);

	public:
		//Constructors
		string();
		string(char *array, int size);
		//Deconstructor
		~string();

		int str_length();
		int str_compare();
		void str_reverse();
		bool str_replace_first();

		int length_iter();
		int str_compare_iter();
		void str_reverse_iter();
		bool str_replace_first_iter();

		//Overloaded Operators
		void operator+(string &rstring);
		friend std::istream &operator >>(std::istream &is, string &string);
		friend std::ostream &operator <<(std::ostream &os, string &string);
};		
string::string()
{
	_string = new char[100];
	_string[0] = '\0';
}

string::string(char *array, int size)
    {
        int i;
	    _string = new char[size+1]; // +1 for the string's null terminator character
	    for(i=0; i < size; i++)
	    {
            _string[i] = array[i];
	    }
        _string[i] = 0; // add string's null terminating character
    }
//Deconstructor
string::~string()
{
	delete [] _string;
}
/**
 * This function finds the length of a c-string using recursion
 * @param str[ ] a c-string variable that stores a string from user
 * @pre  in main command = "length", str[0] is not an empty string-'\0'
 * @post if str[0]='\0' then 0 is returned or str_length is called again but at the next index of str[]
 * @return the length of the c-string str[]
 */
int string::str_length(const char str[])
{
	//base case
	if (str[0] == '\0')
		return 0;
	//recursive statement
	else
		return 1 + str_length(str+1);
}

/**
 * This function finds the length of a c-string using iteration
 * @param str[ ] a c-string variable that stores a string from user
 * @pre in main command = "length_iter", str[ ] is not an empty string-'\0'
 * @post i is < 0
 * @return the length of the c-string str[]
 */
int string::length_iter(const char str[])
{
	int i=0;
	while(str[i] != '\0')
	{
		i++;
	}
	return i;
}

/**
 * This recursive function compares 2 c-strings to see if they are equal or there is a character mismatch
 * @param *str1 is a pointer to charArray[ ]
 * @param *str2 is a pointer to scharArray2[ ]
 * @pre in main command = "compare", str1[ ] and str2[ ] is not an empty string-'\0'
 * @post str1[] and str2[ ] are equal or *str1 and *str2 point to different characters
 * @return a integer vaule that is the distance between the ASCII character vaules.  If *str1 points to
a smaller character, the vaule is negative.  If *str2 points to the a smaller character the value is positive.
If both *str1 and *str2 do not point to a mismatch, then str1[ ] and str2[ ] are equal and 0 is returned 
 */	
int string::str_compare(const char *str1, const char *str2)
{
    if (*str1 != '\0' || *str2 != '\0')
    {
        if (*str1 != *str2)
        {
            if (*str1 > *str2)
            {
                return *str1 - *str2;
            }
            else if (*str1 < *str2)
            {
                return *str1 - *str2;
            }
        }
        
    }
    else return 0; //C-strings are equal-base case
    //recursive statement
    return str_compare(str1 + 1, str2 + 1);
}	

/**
 * This iterative function compares 2 c-strings to see if they are equal or there is a character mismatch
 * @param str1[ ] is a c-string variable that stores a string from user
 * @param str2[ ] is a c-string variable that stores a string from user
 * @pre in main command = "compare_iter", str1[ ] and str2[ ]  are not an empty string-'\0'
 * @post str1[] and str2[ ] are equal or str1[i]  and str2[i]  contain different characters
 * @return a integer vaule(diff) that is the distance between the ASCII character vaules.  If str1[i] contains
a smaller character, the vaule(diff) is negative.  If str2[i] contains the a smaller character the value(diff) is positive.
If both str1[i]  and str2[i]  do not contain a mismatch, then str1[ ] and str2[ ] are equal and 0 is returned (diff)
*/
int string::str_compare_iter(char str1[], const char str2[])
{
	for( ; *str1=*str2; *str1++, str2++)
	{
	     if(*str1 == 0)
            return 0;
	}
   
	return int(*str1-*str2); 
}

/**
 * This recursive function will reverse the c-string str
 * @param *str is a pointer to charArray[ ]
 * @param length is the length of charArray[ ]
 * @pre in main command = "reverse", *str does notpoint to an empty string-'\0'
 * @post the string in charArray[ ]  is reversed
 * @return no return value
 */
void string::str_reverse(char *str, int length)
{
	
	char temp, temp1;
    	
    if (length >= 1)
    {
         // swap first & last chars    
         temp = str[0];
         str[0] = str[length-1];
         str[length-1] = temp; 
         // recursive call--
         str_reverse(&str[1], length-2);
    }
}    

/**
 * * This recursive function will reverse the c-string str
 * @param str[ ] str1[ ] is a c-string variable that stores a string from charArray[ ]
 * @param length is the length of charArray[ ]
 * @pre in main command = "reverse_iter", str[ ]  does notpoint to an empty string-'\0'
 * @post the string in charArray[ ]  is reversed
 * @return no return value
 */	
void string::str_reverse_iter(char str[], int length)
{
	char temp;
	int starti, endi, mid;//starting and ending index
	starti = 0;
	endi = length - 1;
	mid = length / 2;
	
	while(starti < mid)
	{
		temp = str[starti];
		str[starti] = str[endi-starti];
		str[endi-starti] = temp;
		starti++;
	}
}

/**
 * This recursive function will search a c-string for a character(s) to be replaced with other character(s)
 * @param *str points to charArray[ ] the array to be searched
 * @param *find points to charArray2[ ], contains what to search for
 * @param*replace points to charArray3[ ] what to replace the characters with
 * @param is_partial_match  is true if part of the find string is found in the original string
 * @pre  in main command = "replace_first", *str[ ] , *find, *replace does nont point to an empty string-'\0'
 * @post Either the string was found and replaced in the array or *find and *replace were not equal in size thus the array was not searched
 * @return false condition if *find and *replace were not equal in size thus the array was not searched or
 true condition if *find and *replace were equal in size thus the array was searched and replaced with the contents *replace points to
 */
bool string::str_replace_first(char *str, const char *find, const char *replace)
{
	if(length_iter(find) != length_iter(replace))
	{
		cout << "ERROR: The find and replace strings are of different length." << endl;
		cout << "Please change the find and replace strings to the same length." << endl;
		return false;
	}
	
	while(*str != '\0')
    {        
            
    if(*str == *find)
		{
			*str = *replace;
			*replace++;
			*find++;
        }

	else	str_replace_first(str+1, find, replace);
}
    return true;
}

/**
 * This iteraive function will search a c-string for a character(s) to be replaced with other character(s)
 * @param str points to charArray[ ] the array to be searched
 * @param find points to charArray2[ ], contains what to search for
 * @param replace points to charArray3[ ] what to replace the characters with
  * @param is_partial_match  is true if part of the find string is found in the original string
 * @pre  in main command = "replace_first_iter", str , find, replace does nont point to an empty string-'\0'
 * @post Either the string was found and replaced in the array or find and replace were not equal in size thus the array was not searched
 * @return false condition if find and replace were not equal in size thus the array was not searched or
 true condition if find and replace were equal in size thus the array was searched and replaced with the contents replace points to
 */
bool string::str_replace_first_iter(char str[], const char find[], const char replace[])
{
	if(length_iter(find) != length_iter(replace))
	{
		cout << "ERROR: The find and replace strings are of different length." << endl;
		cout << "Please change the find and replace strings to the same length." << endl;
		return false;
	}
	int i, j, k, m, n, delta;
    int n1, n2, n3;
    char* p, *q;
    if (!str || !find)
        return 0;
    if (!replace)
        replace = "";
    n1 = str_length(str);
    n2 = str_length(find);
    n = n1 - n2 + 1;
    for (i = 0; i < n; ++i)
    {
        for (j = 0; j < n2 && find[j] == str[i+j]; ++j)
            ;
        if (j == n2) // found
        {
            n3 = str_length(replace);
            delta = n3 - n2;
            m = n1 - i - n2;
            if (delta < 0) /* move left */
            {
                p = str + (i + n2 + delta);
                q = p - delta;
                for (k = 0; k <= m; ++k)
                    p[k] = q[k];
            }
            else if (delta > 0) /* move right */
            {
                q = str + n1 - m;
                p = q + delta;
                for (k = m; k >= 0; --k)
                    p[k] = q[k];
            }
            for (k = 0; k < n3; ++k)
                str[i+k] = replace[k];
            return str + i + n3;
        }
    }
    return 0;
}

int string::str_length(){
	return str_length(_string);}

int string::str_compare(){
	return str_compare(_string, _string);}

void string::str_reverse(){
	return str_reverse(_string, str_length(_string));}

bool string::str_replace_first(){
	return str_replace_first(_string, _string, _string);}

int string::length_iter(){
	return length_iter(_string);}

int string::str_compare_iter(){
	return str_compare_iter(_string, _string);}

void string::str_reverse_iter(){
	return str_reverse_iter(_string, str_length(_string));}

bool string::str_replace_first_iter(){
	return str_replace_first_iter(_string, _string, _string);}

void string::operator+(string &rstring)
{
	//string temp();
	int len = length_iter(_string) + rstring.length_iter();
    string temp(_string, len);
    int i;
    for (i = 0; i < length_iter(_string); i++)
         temp[i] = _string[i];
    for (int j = 0; j < rstring.length_iter(); j++, i++)
        temp[i] = rstring[j];
    //rstring[len]='\0';
}

istream &operator >>(std::istream &is, string &string)
{
	for(int i = 0; i < string.length_iter(); i++)
		is >> string[i];
}

ostream &operator <<(std::ostream &os, string &string)
{
	for(int i = 0; i < string.length_iter(); i++)
		os << string[i];
	return os;
}

namespace string
{
	class CD : public string
	{
		private:
			string artist, title, descrip;
			int year;
		
		public:
			CD();
			CD(string artist, string title, string descrip, int year);
			friend std::istream& operator >>(std::istream &is, CD &CD);
};
	CD::CD()
	{
    
	}

	CD::CD(string artist, string title, string descrip, int year) : artist(&artist[0], artist.length_iter()),
		title(&title[0], title.length_iter()), descrip(&descrip[0], descrip.length_iter()), year(0)
	{
    
    }

	friend std::istream& operator >>(std::istream &is, CD &CD)
	{
		is.getline(artist, 100);
		is.getline(album, 100);
		is >> year;
		is.getline(descrip, 100);
		do
		{
			is.getline(descrip, 100);
		} while(descrip != 'END');
		return is;
	}
	}


int main(){
    CD one;
    one.artist >> "The Cure";
    one.title >> "Boys Don't Cry";
    one.year >> 1985;
    one.descrip >> "The best.";
    return 0;
}

In my first post, I said DVD's, but it is CD's that I'm keeping track of. I did what Dougy83 suggested. Ancient Dragon, I have read all my assigned readings. We just started the fourth chapter. I wouldn't expect any instructor to teach from the book.

line: 328 - you need operator[]
line: 338 - you must return istream&
line: 371 - you don't need "friend" key word
line: 365 - &artist[0]??? what is this... you have 2 options: 1. make copy constructor for string class. 2. make function that return char* _string and use your 2nd constructor.
line: 373 - you can't use getline for your class string - you may need to overload it
line: 380 - 'END' - you may mean "END" which is string and '' is use for char
line: 380 - your class string don't have operator !=, so you need it

....
and so on....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.