/*
Ms Gold
Introduction to Basic Programming
My String Libraries
This library consists of 3 functions; stringLength,
stringCompare and stringLibrary
The purpose of this code is to demonstrate what is
needed for your C++ Library Assignment
Remember to have 3 test cases for each function
*/
#include <iostream.h>
// Function Prototypes
int stringLength(char *myString);
bool stringCompare(char *, char *);
bool stringCopy(char *, char *);
/* All Input and Output should be done either in main or a separate
Input/Output function that you create NOT in the C library functions
*/
void main()
{
// all Declarations and Initializations should in main
int len = 0;
bool success = false;
char myString[]= "abcd";
char myString1[20];
char myString2[20];
// call your String Functions
/*
stringLength should return the length of the inputted string.
In main the length should be printed out
*/
len = stringLength( myString);
cout << "length = " << len <<endl;
/*
stringCompare should return true if the strings are equal
or false if they are not
*/
success = stringCompare(myString1, myString2);
/*
stringCopy should return true if the copy was successful
or false if it wasn't
*/
success = stringCopy(myString2, myString1);
}
/*
StringLength returns the length of the inputted string
Input char *
Output int
*/
int stringLength(char * myString) {
for (int i=0; myString[i] != '\0'; i++);
return i;
}
bool stringCompare(char * myString1, char * myString2) {
return true;
}
bool stringCopy(char * myString1, char * myString2) {
return true;
}