我想问一下,如果按照题目的答案A,B来编写程序的话,程序段应该怎么编写
#include<stdio.h>
main()
{
int a=1,b=1;
printf("a=%d\n",a+b);
}如果是B就改printf中的东西就行了
--------------------Configuration: program3 - Win32 Debug--------------------
Linking...
LINK : fatal error LNK1168: cannot open Debug/program3.exe for writing
执行 link.exe 时出错.
program3.exe - 1 error(s), 0 warning(s)
假设a、b变量已正确定义,下面能够正确输出a+b的值的是 ______
A. printf("a=%d\n", a+b);
B. printf("b=%d\n", a+b);
C. A、B都能正确输出a+b的值,只是显示不恰当
D. A、B能不能输出a+b的值
答案:C
解析:%d只是忠实的输出后面传入表达式的值,与双引号中显示的内容无关。因此选C。