#include <iostream>
#include <cstring>
using namespace std;
struct stringy{
char * str;
int ct;
};
stringy & set(stringy & a, char * b);
void show(char * a, int num = 1);
void show(stringy & a, int num = 1);
int main() {
stringy beany;
char testing[] = "reality isn't what it used to be.";
set(beany, testing);
show(beany);
show(beany, 2);
delete [] beany.str;
testing[0] = 'D';
testing[1] = 'u';
show(testing);
show(testing, 3);
show("Done!");
return 0;
}
stringy & set(stringy & a, char * b){
char *p = new char;
strcpy(p, b);
a.str = p;
a.ct = strlen(p);
return a;
}
void show(char * a, int num){
while (num > 0){
cout << a << endl;
num--;
}
}
void show(stringy & a, int num){
while(num > 0){
cout << a.str << endl;
cout << a.ct << endl;
num--;
}
}