更多"下面程序可用来统计文件中字符的个数。
#include<stdi"的相关试题:
[填空题]下面的程序用来统计文件中字符的个数。请填空。
# include<stdio.h>
main( )
FILE *fP;
long num=0;
if( (fp=fopen("fname.dat","r"))==NULL)
printf("Can’t open file! /n");sxit(0);
while 【20】
fgetc(fp);num++;
printr("num=%d/n",num);
fclose (fp);
[填空题]下面程序的功能是用来统计文件中字符个数。请填空。
#include"stdio.h"
main( )
long count=OL;
FILE*fp= 【16】 ("text.dat","r");
if(fp==0)
printf("Open error/n");
exit(0);
while( 【17】 )
fgetc(fp);
count++;
fclise(fp);
printf("%1d/n",count);
[填空题]以下程序用来统计文件中字符个数。请填空。
#include "stdio.h"
main( )
{ FILE *fp; long num=0L;
if((fp=fopen("fname.dat","r"))==NULL)
{ pirntf("Open error/n"); exit(0);}
while( 【16】 )
{ fgetc(fp); num++;}
printf("num= /n",num-1);
fclose(fp);
}
[填空题]以下程序用来统计文件中字符个数。请填空。
#include "stdio. h"
main( )
FILE *fp;long num=OL;
if((fp=fopen("fname.dat","r")==NULL)
Pirntf("Open error/n"); exit(0);
while( 【16】 )
fgetc(fp);num++;
printf("num=%1d/n",num-1);
fclose(fp);
[填空题]以下程序用来统计文件中字符的个数。请填空。
#include“stadio.h”
main( )
FILE *fp;long num=0L;
if((fp=fopen(“fname.dat”,“r”))==NULL);
printf(“0pen error/n”);exit(0);
while( 【16】 )
fsetc(fp);num++;
printf(“num=%1d/n”,num-1);
fclose(fp);
[填空题]以下程序用来统计文件字符的个数,请填空。
#include<stdio.h>
#include<string>
void main( )
FILE *fp;long num=0;
if ((fp=fopen("fname.dat"," r"))==NULL)
printf("Open error/n");
exit(0),
while(______)
fgetc(fp);num++;
printf("num=%1d/n",num-1);
fclose(fp);
[填空题]
以下程序用以删除字符串所有的空格,请填空。
#include
main( )
{ char s[100]={"Our teacher teach C language!"};int i,j;
for(i=j=0;s[i]!=’/0’;i++)
if(s[i]!= ’ ’) {s[j]=s[i];j++;}
s[j]= ()
printf(“%s/n”,s);
}
[填空题]下列程序用来判断指定文件是否能正常打开,请填空。
#include<stdio.h>
main( )
(FILE *fp;
if(((fp=fopen("test.txt","r")!=______))
printf("文件打开成功!/n");
else
printf("未能打开文件!/n");
[填空题]
以下程序用来判断指定文件是否能正常打开,请填空。
#include<stdio.h>
main( )
{FILE*fp;
if(((fp=fopen("test.txt","r"))=()))
printf("未能打开文件!/n");
else
printf("文件打开成功!/n");
}
[填空题]下面的程序可对指定字符串中的字符串进行从大到小排序,请将程序完整。 (注:程序采用了冒泡排序算法)
#include<stdio.h>
#include<string.h>
main( )
char*str="ABCDabcd",temp;
int n,i;
n=strlen(str);
while(n->1)
for(i=0;i<n;i++)
if(str[i]<str[i+1])
temp=______;
str[i]=str[i+1];
______=temp;
printf(______);
[填空题]下面的程序可对指定字符串中的字符串进行从大到小排序,请将程序填完整。 (注:程序采用了冒泡排序法)
#include<stdio.h>
#include<string.h>
main( )
char*str="ABCDabcd",temp;
int n,i;
n=strlen(str);
while(n-->1)
for(i=0;i<n;i++)
if(str[i]<str[i+l])
temp= 【12】 ;
str[i]=str[i+l];
【13】 =temp;
printf( 【14】 );
[填空题]下面的程序可对指定字符串中的字符串进行从大到小排序、请将程序填完整。 (注:程序采用了冒泡排序算法)
#include<stdio.h>
#include<string.h>
main( )
char*str="ABCDabcd",temp;
int n,i;
n=strlen(str);
while(n->1)
for(i=0;i<n;i++
if(str[i]<str[i+1])
temp= 【17】 ;
str[i]=str[i+1];
【18】 =temp;
printf( 【19】 );