下列程序的执行结果是______。
include<iostream.h>
float temp;
float&fn2(float r)
{
temp=r*r*3.14;
return temp;
}
void main( )
{
float a=fn2(5.0);
float&b=fn2(5.0);
b=20;
cout<<temp<<endl;
}
第1题:
有如下的程序:
include <iostream>
include <fstream>
using namespace std;
int main()
{
ofstream outf("D:\\temp.txt",ios_base::trunc) ;
outf<<"World Wide Web";
outf.close();
ifstream inf("D:\\temp.txt");
char s[20];
inf>>s;
inf.close();
cout<<s;
return 0;
}
执行后的输出结果是【 】。
第2题:
下面程序的结果为( )。 #include"iostream.h" void change(int a,int b) { int temp; temp=a; a=b b=temp; } void main() { int m,n; m=8; n=9; change(m,n); cout<<m<<" "<<n<<endl; }
A.89
B.98
C.程序有错误
D.99
第3题:
15、以下程序执行的结果是: my_dict={'bill':1,'rich':2,'fred':10,'walter':20} temp = 0 for value in my_dict.values(): temp = temp + value print (temp)
第4题:
下面程序输出的结果为( )。 #include<iostream.h> void fun(int a,int b) { int temp; temp=a; a=b; b=temp; } void main() { int m,n; m=1; n=2; fun(m,n); cout<<m<<""<<n<<end1; }
A.12
B.21
C.22
D.程序有错误
第5题:
下面程序的运行结果为( )。#include<iostream.h>void swap (int &a, int b){int temp;temp=a++;a=b;b=temp;}void main(){int a=2, b=3;swap(a,b);cout<<a<<","<<b<<end1;}
A.2,3
B.3,2
C.2,2
D.3,3