以下程序的输出结果是 。
#include
using namespace std;
int main()
{
int num = 50;
int& ref = num;
ref = ref + 10;
cout <<"num = "<num = num + 40;
cout <<"ref = "<return 0;
}
#include
using namespace std;
int main()
{
int num = 50;
int& ref = num;
ref = ref + 10;
cout <<"num = "<
cout <<"ref = "<return 0;
}
举一反三
- 阅读以下程序,写出运行结果。 #include using namespace std; class Test { private: int num; public: Test(); Test(int n); }; Test::Test() { cout << "Init defa" << endl; num = 0; } Test::Test(int n) { cout << "Init" << " " << n << endl; num = n; } int main() { Test x[2]; Test y(15); return 0; }
- 中国大学MOOC: 下面程序执行后的输出结果是:#include <iostream>#include <cmath>using namespace std;struct NODE {int num; struct NODE *next;};int main(){struct NODE *p,*q,*r;p=new NODE;q=new NODE;r=new NODE;p->num=10; q->num=20; r->num=30;p->next=q;q->next=r;cout<<p->num+q->next->num<<endl; return 0;}
- 以下程序的输出结果是#include<;stdio.h>;int fun6(int num){ int k=1;do{ k*=num%10; num/=10;}while(num);return k;}main( ){ int n=26;printf(“%d\n”,fun6(n));}
- 下列程序运行后的输出结果为。 # include <stdio.h> int num; void fun { printf ( "%d, ", num ); } int main { int num = 3; fun ; printf ( "%d,", num ); return 0; }
- 下面程序的输出结果是( )。#include <;stdio.h>;int num=10;int func(){int num=4;return ++num;}int main(){printf("%d\n",func());return 0;} A: 1 B: 4 C: 5 D: 10