stdio.h文件中包含标准输入输出函数的函数说明,通过引用此文件以便能正确使用prinff、scanf等函数
将stdio.h中标准输入输出函数链接到编译生成的可执行文件中,以便能正确运行
将stdio.h中标准输入输出函数的源程序插入到引用处,以便进行编译链接
将stdio.h中标准输入输出函数的二进制代码插入到引用处,以便进行编译链接
第1题:
以下叙述中正确的是( )。
A.预处理命令行必须位于C源程序的起始位置
B.在C语言中,预处理命令行都以“#”开头
C.每个C程序必须在开头包含预处理命令行:#include<stdio.h>
D.C语言的预处理不能实现宏定义和条件编译的功能
第2题:
在C++中,若需要在程序文件中进行标准输入输出操作,则必须在开始处加入预处理命令include<iostream.h>,若使用到数学库中的函数时,要在源程序的开始处加入预处理命令【 】。
第3题:
以下四个程序中,完全正确的是( )。
A.#include<stdio.h>
B.#include<stdio.h> main(); main() {/*programming*/ {/*/programming/*/ printf("programming!\n");} printf("programming!\n");}
C.#include<stdio.h>
D.include<stdio.h> main() main() {/*/*programming*/*/ {/*programming*/ printf("programming!\n");} printf("programming!\n");}
第4题:
下列4个程序中,完全正确的是( )。
A.#include<stdio.h> main(); (/*programming*/ printf("programming!\n");}
B.# include<stdio.h> main() {/*/programming/*/ printf("programming!\n");}
C.#include<stdio.h> main() {/*/programming*/*/ printf("programming!\n");)
D.include<stdio.h> main() {/*programming*/ printf("programming!\n");}
第5题:
以下程序用来判断指定文件是否能正常打开,请填空。
include<stdio.h>
main()
{FILE*fp;
if(((fp=fopen("test.txt","r"))=【 】))
printf("未能打开文件!\n");
else
printf("文件打开成功!\n");
}
第6题:
以下程序的输出结果是 【7】 。
#include "stdio.h"
main()
{int a=065;
printf( "%d\n",--a);
}
第7题:
执行以下程序后,test.txt文件的内容是(若文件能正常打开) ( )。#include <stdio.h>#include <stdlib.h>main( ){ FILE * fp; char * s1 = "Fortran" , * s2 = "Basic"; if((fp = fopen( "test. txt" ," wb" )) = = NULL) { prinff( "Can't open test. txt file \n"); exit(1); } fwrite( s1 ,7,1 ,fp); /* 把从地址s1开始到7个字符写到fp所指文件中*/ fseek(fp,OL,SEEK_SET); /*文件位置指针移到文件开头*/ fwrite (s2,5,1,fp); felose (fp);}
A.Basiean
B.BasieFortran
C.Basic
D.FortranBasie
第8题:
为使*p=20,下面正确的程序是 ( )
A.# include<stdio.h> main( ) { int a=10,b=20,*p=&b; printf("%d\t%d\n",p,*p); } *p)
B.# include<stdio.h> main( ) { int a=10,b=20,*p=b; printf("%d\t\%d\n",p,*p) }
C.# include<stdio.h> main( ) { int a=10,b=20,*p; p=&a; p + +; printf("%d\t\%d\n",p,*p);} }
D.# include<stdio.h> main( ) { int a=10,b=20,*p; *p=20; printf("%d\t\%d\n",p,*p); }
第9题:
以下程序的输出结果是#include "stdio.h"main(){ int a=065; printf("%d\n",--a);}
第10题:
请编写函数fun(),它的功能是计算:s=(1-In(1)-In(2)-In(3)-…-1n(m))2
s作为函数值返回。
在C语言中可调用log(n)函数求In(n)。log函数的引用说明是double log(double x)。
例如,若m的值为15,则fun()函数值为723.570801。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include <conio.h>
include <stdio.h>
include <math.h>
double fun(int m)
{
}
main()
{
clrscr();
printf("%f\n",fun(15));
}