i have both the testing program and the header file for a class. i need to write the class functions.
here is the testing program
[#include<iostream>
#include "String1030.h"
using std::cout;
using std::cin;
int main()
{
// check the constructors
String1030 s("My string");
String1030 t(s);
String1030 x;
//set to a negative value, nothing should change
s.setSize(-8);
cout << "S size(): " << s.getSize() << endl;
//set to 0, should be 0
s.setSize(0);
cout << "S size(): " << s.getSize() << endl;
//read into the 0 length array should NOT have an error
//and should NOT transfer any characters. Output should not
//have any errors either.
cin >> in_buf;
s.setString(in_buf);
cout << "S after cin>>: " << s.getString() << endl;
//reset to something larger than 0
s.setSize(10);
cout << "S size(): " << s.getSize() << endl;
//read should work now
cin >> in_buf;
s.setString(in_buf);
cout << "S after cin>>: " << s.getString() << endl;
the printout should look like this
S size(): 9
T size(): 9
X size(): 0
My string
My5string
X: My5string
StringOne
x: StringOne
S size(): 9
S size(): 0
StringTwo
S after cin>>: StringTwo
S size(): 10
StringThree
S after cin>>: StringThree
T: StringThree
X: StringThree