有以下程序 #include <stdio.h> main() { int a=1, b=3, c=5; int *p1=&a, *p2=&b, *p=&c; *p =*p1*(*p2); printf("%d\n",c); }执行后的输出结果是()
A.1
B.2
C.3
D.4
- · 有4位网友选择 B,占比40%
- · 有3位网友选择 A,占比30%
- · 有2位网友选择 D,占比20%
- · 有1位网友选择 C,占比10%
A.1
B.2
C.3
D.4
有以下程序 #include <stdio.h> main() { int aa[3][3]={ {2},{4},{6} }, i, *p = &aa[0][0]; for ( i=0; i<2; 0 i++ ) { if( i="=" aa[i][i+1]="*p" + 1; else ++p; printf("%d ", *p ); } 程序运行后的输出结果是(> A、2 6
B、2 3
C、4 3
D、4 6
A.1 2
B.123 0
C.1 23
D.0 0
有以下程序 #include <stdio.h> void fun( int a, int b, int c ) { a=b; b=c; c=a; } main() { int a=10 , b=20, c=30; fun( a, b, c ); printf("%d,%d,%d\n",c,b,a); }程序运行后的输出结果是( )
A、10,20,30
B、30,20,10
C、20,30,10
D、0,0,0
A.8
B.12
C.5
D.7
有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y &ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y &ob) ; }; void X: :show(Y &ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main () { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是()。
A.X,Y
B.a,b
C.X,X
D.Y,Y
有以下程序 #include<iostream> #include<string> using namespace std; class base { private: charbaseName[10]; public: base() { strcpy(baseName,"Base"); } virtual char*myName() return baseName; } char *className() { return baseName; } }; class Derived: public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName,"Derived"); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base &p) { cout<<p.myName0<<" "<<p.className(); } int main() { base bb; Derived dd; showPtr(dD) ; retum 0; } 动行后的输出结果为
A.Derived Base
B.Base Base
C.Derived Derived
D.Base Derived
A.Base Class
B.Derivel Class
C.Derive2 Class
D.程序编译时出错
include <fstream>
include <string>
using namespace std;
int main ()
{
char ch[] = "The end";
ofstream outstr("d:\\put.txt", ios_base: :app);
for (int i = 0; i < strlen(ch ); i++ )
outstr.put(ch[i]);
outstr.close();
return 0;
}
程序实现的功能是【 】。
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!