CIS 3100讲解、辅导C++编程设计、C++讲解、辅导Object-Oriented 调试Matlab程序|辅导R语言程序
Object-Oriented Programming I Fall 2018
CIS 3100
Programming Assignment 6
For this assignment, you are to implement the String class, the specification of which is shown
below. Using this String class you are then to implement an application to sort a sequence of
words input by the user. This application should begin by asking the user how many words, not
to exceed 100, are to be input. Once the user has input a valid value, your program should then
prompt the user to enter each of the words that are to be sorted, with one prompt per word being
used. After the last word has been input, the program should sort the word in ascending order,
and then out the words, one per line
For this assignment, you may use any of the Cstring functions available in C++.
In addition to the application that you are implementing, I will also supply you with a main()
function that will be used to test your code.
Due Date: December 18, 2018String Class Specification:
class String {
private:
char strval[101]; //holds string value
public:
//constructors
String(); //initializes default value of null
//string
String(char s[]); //initializes string to value of
//cstring s
//access functions
void ToCstring(char s[]); //convert value to cstring s
bool EqualTo(String s); //true if value equal to s
//else false
bool LessThan(String s); //true if value less than s,
//else false
bool GreaterThan(String s); //true if value greater than
//s, else false
int Length(); //returns length of string
String Concat(String s); //returns concatenation of s
//to string value
//modifier functions
//No modifier function specified
//input/output functions
void Read(); //reads in string value from
//istream, no prompt given
void Write(); //outputs string value to
//ostream, no newline inserted
//destructor
//No destructor defined.
};