在下面程序下划线处填上适当内容,使程序执行结果为:200--100#include using namespace std;template (1)_________T f(T x, T y){ if (sizeof(T) == (2)______)return x + y; elsereturn x*y;}void main() { cout << f(10, 20) << "--" << f(45.5, 54.5) << endl;}
查看答案
下列程序的运行结果是-1。#includeusing namespace std;int f(int x,int y){ int c; if ((1)______________)c = 1; else if ((2)______________)c = 0; elsec = -1; return c;}void main(){ int i = 2, j = 3; int p = f((3)______); cout << p << endl;}
下列程序的输出结果如下:x, y=10,26x, y=10,26x, y=11,25请将程序填充完整#include < iostream>using namespace std;void f2((1)____){ int z = x; x = y; y = z;}void main( ){ int x = 10, y = 26; cout << "x, y=" << x << "," << y << endl; f2(x,y); cout << "x, y=" << x << "," << y << endl; x++; y--; f2(x,y); cout << "x, y=" << x << "," << y << endl;}
下列程序的输出结果如下:x, y=10,26x, y=26,26x, y=25,25请将程序填充完整#include < iostream>using namespace std;void f2((1)____){ int z = x; x = y; y = z;}void main(){ int x = 10, y = 26; cout << "x, y=" << x << "," << y << endl; f2(x,y); cout << "x, y=" << x << "," << y << endl; x++; y--; f2(x,y); cout << "x, y=" << x << "," << y << endl;}
下列程序的输出结果如下:x, y=10,26x, y=26,10x, y=9,27请将程序填充完整#include < iostream>using namespace std;void f2((1)________){ int z = x; x = y; y = z;}void main(){ int x = 10, y = 26; cout << "x, y=" << x << "," << y << endl; f2(x,y); cout << "x, y=" << x << "," << y << endl; x++; y--; f2(x,y); cout << "x, y=" << x << "," << y << endl;}