重要提示:请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
首页 > 考试题库
网友您好,请在下方输入框内输入要搜索的题目:
搜题
如搜索结果不匹配,请联系老师获取答案
扫码添加老师QQ
扫码添加老师微信
题目内容 (请给出正确答案)
[主观题]

#include <stdio.h> void foo(int m, int n) { printf("m=%d, n=%d\n", m, n); } int ma

#include <stdio.h>

void foo(int m, int n)

{

printf("m=%d, n=%d\n", m, n);

}

int main()

{

int b = 3;

foo(b+=3, ++b);

printf("b=%d\n", b);

return 0;

}

答案
查看答案
更多“#include <stdio.h> void foo(int m, int n) { printf("m=%d, n=%d\n", m, n); } int ma”相关的问题

第1题

改错: #include <stdio.h> int main(void) { int **p; int arr[100]; p = &arr;

改错:

#include <stdio.h>

int main(void) {

int **p;

int arr[100];

p = &arr;

return 0;

}

点击查看答案

第2题

以下程序的输出结果是()#include<stdio.h>main(){ unsigned short a=65537; int b;printf(&quo

以下程序的输出结果是()

#include<stdio.h>

main()

{ unsigned short a=65537; int b;

printf("%d/n" ,b=a);

}

点击查看答案

第3题

Consider the following code:#include <stdio.h>#include <string.h>int main(i

Consider the following code:

#include <stdio.h>

#include <string.h>

int main(int argc, char *argv[]) {

int i = 1;

char buf[4];

strcpy(buf, "AAAA");

printf("%d\n", i);

return 0;

}

a) When compiled and executed on x86, why

does this program usually not

output what the programmer intended?

点击查看答案

第4题

#include <stdio.h> #include <stdlib.h> void getmemory(char *p) { p=(char *)

#include <stdio.h>

#include <stdlib.h>

void getmemory(char *p)

{

p=(char *) malloc(100);

strcpy(p,"hello world");

}

int main()

{

char *str=NULL;

getmemory(str);

printf("%s/n",str);

free(str);

return 0;

}

程序崩溃,getmemory中的malloc 不能返回动态内存, free()对str操作很危险

5.char szstr[10];

strcpy(szstr,"0123456789");

产生什么结果?为什么?

点击查看答案

第5题

请写出下列代码的输出内容 #include<stdio.h> main() { int a,b,c,d; a=10; b=a++; c=+

请写出下列代码的输出内容

#include<stdio.h>

main()

{

int a,b,c,d;

a=10;

b=a++;

c=++a;

d=10*a++;

printf("b,c,d:%d,%d,%d",b,c,d);

return 0;

}

点击查看答案

第6题

请写出下面代码在32 位平台上的运行结果,并说明sizeof 的性质:#include <stdio.h>#incl

请写出下面代码在32 位平台上的运行结

果,并说明sizeof 的性质:

#include <stdio.h>

#include <stdlib.h>

int main(void)

{

char a[30];

char *b = (char *)malloc(20 *

sizeof(char));

printf("%d\n", sizeof(a));

printf("%d\n", sizeof(b));

printf("%d\n", sizeof(a[3]));

printf("%d\n", sizeof(b+3));

printf("%d\n", sizeof(*(b+4)));

return 0 ;

}

点击查看答案

第7题

写出下列代码的输出内容 #include<stdio.h> int inc(int a) { return(a); } int mult

写出下列代码的输出内容

#include<stdio.h>

int inc(int a)

{

return(a);

}

int multi(int*a,int*b,int*c)

{

return(*c=*a**b);

}

typedef int(FUNC1)(int in);

typedef int(FUNC2) (int*,int*,int*);

void show(FUNC2 fun,int arg1, int*arg2)

{

INCp=&inc;

int temp =p(arg1);

fun(&temp,&arg1, arg2);

printf("%d\n",*arg2);

}

main()

{

int a;

show(multi,10,&a);

return 0;

}

点击查看答案

第8题

找错:#include <string.h>#include <stdio.h>class Base{private:char * name;pu

找错:

#include <string.h>

#include <stdio.h>

class Base

{

private:

char * name;

public:

Base(char * className)

{

name = new char[strlen(className)];

strcpy(name, className);

}

~Base()

{

delete name;

}

char * copyName()

{

char newname [256];

strcpy(newname, name);

return newname;

}

char * getName()

{

return name;

37

}

static void print(Base base)

{

printf("name: %s\n" , base.name);

}

};

class Subclass : public Base

{

public:

Subclass(char * className) : Base(className)

{

}

};

int main()

{

Base * pBase = new Subclass("test");

Base::print(*pBase);

printf("name: %s\n", pBase->getName());

printf("new name: %s\n", pBase->copyName());

return 0;

}

点击查看答案

第9题

下面程序的功能是:根据输入的整数x和n,利用函数fact实...

下面程序的功能是:根据输入的整数x和n,利用函数fact实现求。 例如:输入:2,3 输出=8 请在程序中的横线上填入正确的内容,将程序补充完整。 /* c7-1.c 利用函数fact实现求x的n次方*/ #include "stdio.h" int main() { long int fact(long x,long n) ; /*声明fact函数*/ long int x ; long int n; printf("please enter X and N(>=0): "); scanf("%ld,%ld", &x, &n ); printf("%ld,%ld=%ld",x,n, (1) ); /*调用fact函数 */ return 0; } long int fact(long int x, long int n) /*定义fact函数求xn */ { long int i,s; (2) ; /*求累积变量的初始化*/ if (n= =0) return 0; for(i=1; i<=n; i++) *用循环实现xn* s="s*x;" (3) ; *返回结果xn*>

点击查看答案

第10题

从键盘输入你的出生年月,编程输出你出生的月份有多少...

从键盘输入你的出生年月,编程输出你出生的月份有多少天,是什么季节,假设规定3~5月为春季,6~8月为夏季,9~11月为秋季,1、2和12月为冬季。要求程序能够在用户输入非法字符或者非法的年份和月份时输出错误提示信息:"Input error!\n",并结束程序的执行。 要求考虑闰年的情况,已知满足如下条件之一的就是闰年: (1)能被4整除但不能被100整除; (2)能被400整除。 **输入格式要求:"%d, %d" 提示信息:"Input year,month:" **输出天数的格式要求:"%d days\n" **输出季节的格式要求:"The season is spring\n","The season is summer\n","The season is autumn\n","The season is winter\n" 如果输入了非法字符或者年份小于1或者月份不在合法的区间内,则输出"Input error!\n",并结束程序的执行。 程序运行示例如下: Input year,month:2012,2↙ 29 days The season is winter 补全缺少的语句 #include <stdio.h> #include <stdlib.h> int main() { int year, month, n; printf("Input year,month:"); n = scanf("%d, %d", &year, &month); if (____________) { printf("Input error!\n"); exit(0); } if (____________ ) { if (____________ ) printf("29 days\n"); else printf("28 days\n"); } else if (____________ ) printf("30 days\n"); else printf("31 days\n"); if (month >= 3 && month <= 5) printf("the season is spring\n"); else if (month>= 6 && month <= 8) printf("the season is summer\n"); else if (month>= 9 && month <= 11) printf("the season is autumn\n"); else winter\n"); return 0;> A、第一句: n != 2 || year < 1 || month < 1 || month >12 第二句: month == 2 第三句: year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) 第四句:month == 4 || month == 6 || month == 9 || month == 11

B、第一句: n != 2 || year < 1 || month < 1 || month >12 第二句: month = 2 第三句: year % 4 = 0 && year % 100 != 0) || (year % 400 = 0) 第四句:month = 4 || month = 6 || month = 9 || month = 11

C、第一句: n != 2 && year < 1 && month < 1 && month >12 第二句: month == 2 第三句: year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) 第四句:month == 4 && month == 6 && month == 9 && month == 11

D、第一句: n = 2 || year < 1 || month < 1 || month >12 第二句: month = 2 第三句: year % 4 = 0 && year % 100 != 0) || (year % 400 = 0) 第四句:month = 4 || month = 6 || month = 9 || month = 11

点击查看答案
下载APP
关注公众号
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案 购买前请仔细阅读《购买须知》
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《服务协议》《购买须知》
立即支付 系统将自动为您注册账号
已付款,但不能查看答案,请点这里登录即可>>>
请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
请用微信扫码测试
优题宝