1. 阅读下面的程序,写出 main 的输出。int h(int iCount, const int* ipIndex, int& irObj){iCount %= 2;if (*ipIndex >= 5)irObj += iCount;return *ipIndex + irObj;}void main(){int i, j = 1, k = 2, m;for (i = 0; i < 10; i++, j++) {m = h(i, &j, k);printf("i = %2d, j = %2d, k = %2d, m = %2d.\n", i, j, k, m);}}答案:i = 0, j = 1, k = 2, m = 3. i = 1, j = 2, k = 2, m = 4. i = 2, j = 3, k = 2, m = 5. i = 3, j = 4, k = 2, m = 6. i = 4, j = 5, k = 2, m = 7. i = 5, j = 6, k = 3, m = 9. i = 6, j = 7, k = 3, m = 10. i = 7, j = 8, k = 4, m = 12. i = 8, j = 9, k = 4, m = 13.i = 9, j = 10, k = 5, m = 15.2. 用 C++语言定义 MyString(包括成员函数的实现代码),使之能符合下面程序及在注释中描述的运行结果的要求:void main(){MyString s1 = "0123456789", s2(5), s3;s1.display(); // 此时显示出: <0123456789> s2.display(); // 此时显示出(<>之间是五个空格): < >s3.display(); // 此时显示出: <>s3 = s1;s3.display(); // 此时显示出: <0123456789> s2 = s1[2];s2.display(); // 此时显示出: <23456789> s1.display(); // 此时显示出: <0123456789> s3 = s2++;s2.display(); // 此时显示出: <3456789> s3.display(); // 此时显示出: <23456789> }答案:#include using namespace std; class MyString{char cpBody[81];public:MyString(const char* p = NULL);MyString(int i);MyString& operator=(const MyString& s){ strncpy(cpBody, s.cpBody, 80); return *this; }MyString& operator[](int i);MyString& operator++(int i){ static MyString s; s = *this; *this = (cpBody[0] == '\0') ? *this : (*this)[1]; return s; }void display() {printf("<%s>\n", cpBody); }};MyString::MyString(const char* p){if (p == NULL)cpBody[0] = '\0';elsestrncpy(cpBody, p, 80);}MyString::MyString(int i){ int j;for (j = 0; j < i && j < 80; j++)cpBody[j] = ' ';cpBody[j] = ...