#include<iostream>
using namespace std;
#include<cstring>
struct stringy
{
char *str1;
int ct;
};
void set(stringy &str, const char *st);
void show(const stringy &str, int n = 1);
void show(const char* str, int n = 1);
int main()
{
stringy beany;
char texting[] = "fajshghsbdfuhy";
set(beany, texting);
show(beany);
show(beany, 2);
texting[0] = 'D';
texting[1] = 'u';
show(texting);
show(texting, 3);
show("Done!");
cin.get();
cin.get();
return 0;
}
void set(stringy &str, const char *st)
{
str.ct = strlen(st);
str.str1 = new char[str.ct];
int i = 0;
while (i<str.ct)
{
str.str1[i] = st[i];
++i;
}
str.str1[i] = '\0';
}
void show(const stringy &str, int n)
{
if (n == 0)
return;
else
{
cout << str.str1 << "\t" << str.ct << endl;
show(str, n - 1);
}
}
void show(const char* str, int n)
{
if (n == 0)
return;
else
{
cout << str << endl;
show(str, n - 1);
}
}
using namespace std;
#include<cstring>
struct stringy
{
char *str1;
int ct;
};
void set(stringy &str, const char *st);
void show(const stringy &str, int n = 1);
void show(const char* str, int n = 1);
int main()
{
stringy beany;
char texting[] = "fajshghsbdfuhy";
set(beany, texting);
show(beany);
show(beany, 2);
texting[0] = 'D';
texting[1] = 'u';
show(texting);
show(texting, 3);
show("Done!");
cin.get();
cin.get();
return 0;
}
void set(stringy &str, const char *st)
{
str.ct = strlen(st);
str.str1 = new char[str.ct];
int i = 0;
while (i<str.ct)
{
str.str1[i] = st[i];
++i;
}
str.str1[i] = '\0';
}
void show(const stringy &str, int n)
{
if (n == 0)
return;
else
{
cout << str.str1 << "\t" << str.ct << endl;
show(str, n - 1);
}
}
void show(const char* str, int n)
{
if (n == 0)
return;
else
{
cout << str << endl;
show(str, n - 1);
}
}