调试下列程序 写出输出结果 并解释输出结果 #include <iostream> using namespace std; cl
已帮助 人
调试下列程序,写出输出结果,并解释输出结果 #include <iostream> using namespace std; class My { public: My(int aa) { A = aa; B -= aa; } static void fun(My m); private: int A; static int B; }; void My::fun(My m) { cout << "A=" << m.A << endl; cout << "B=" << B << endl; }; int My::B = 100; int main() { My P(6), Q(8); My::fun(P); Q.fun(Q); return 0; }

回答
共1条回复-
GFEDCB。 开始指针cp指向字符串结束标志,在循环中,cp依次向前移动,当打印出第二个字符后,cp指向第一个字符,循环判断条件不满足,退出循环,因此,只打印出第一个字符以后的字符的逆序列。
