请补充main 函数,该函数的功能是:先以只写方式打开文件“out99.dat”,再把字符串str中的字符保存到这个磁盘文件中。注意:部分源程序给出如下。请勿改动主函数main 和其他函数中的任何内容,仅在 main 函数的横线上填入所编写的若干表达式或语句。试题程序:include "stdio. h"include "conio.h"define N 80main (){FILE *fp;int i=0;char ch;char str[N]="I'm a student!";clrscr();if ( (fp=fopen (【 】) ) ==NULL){printf("cannot open out99. dat\n");exit(0);}while (str[i]){ch=str[i];【 】;putchar(ch);i++;}【 】;}

请补充main 函数,该函数的功能是:先以只写方式打开文件“out99.dat”,再把字符串str中的字符保存到这个磁盘文件中。

注意:部分源程序给出如下。

请勿改动主函数main 和其他函数中的任何内容,仅在 main 函数的横线上填入所编写的若干表达式或语句。

试题程序:

include "stdio. h"

include "conio.h"

define N 80

main ()

{

FILE *fp;

int i=0;

char ch;

char str[N]="I'm a student!";

clrscr();

if ( (fp=fopen (【 】) ) ==NULL)

{

printf("cannot open out99. dat\n");

exit(0);

}

while (str[i])

{

ch=str[i];

【 】;

putchar(ch);

i++;

}

【 】;

}


相关考题:

请补充main函数,该函数的功能是:从一个字符串中截取前面若干个给定长度的子字符串。其中,str1指向原字符串,截取后的字符存放在str2所指的字符数组中,n中存放需截取的字符个数。例如:当str1=“cdefghij”,然后输入4,则str2=“cdef”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define LEN 80main(){char str1[LEN),str2[LEN);int n,i;clrscr();printf(“Enter the string:\n”);gets(str1);printf“Enter the position of the stringdeleted:”);scanf(【 】);for(i=0;i<n;i++)【 】str2[i]=‘\0’;printf(“The new string is:%s\n”,【 】);}

请补充main函数,该函数的功能是:先以只写方式打开文件file.dat,再把字符串S中的字符保存到这个磁盘文件中。请勿改动main函数与其他函数中的任何内容,仅在的横线上填写所需的若干表达式或语句。 注意:部分源程序给出如下。 试题程序: includestdlib.h includestdio.h define N 100 void main { FILE*f: int i=0: char ch; char s[N]="Welcome!"; if((f=fopenl("【1】","w"))==NULL) { printf("cannot open file.dat\n"); exit(0); } while(s[i]) { ch=s[i]; 【2】 ; putchar(ch); i++: } 【3】 ; }

请补充函数fun(),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。例如,输入“abcdef”,输出“bdf”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80void fun(char s[],int n){int i, j;j=0;for(i=0;【 】;i++){if(【 】)s [j++]-s [i];}【 】;}main ( ){int i=0, strlen=0;char str [N];clrscr ();printf ("\nInput a string: \n");gets (str);while (str [i] !='\0'){strlen++;i++;}fun(str, strlen);printf("\n*** display string ***\n");puts (str);}

请补充main函数,该函数的功能是:把字符串str中的字符向前移动一位,原来的第一个字符移动到字符串尾,结果仍然保存在原字符串中。例如,输入“how do you do?”,则结果输出“ow do you do?h”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。试题程序:include <stdio. h>define N 80main(){char str[N], ch;int i;clrscr ();printf("\n Input a string:In");gets (str);printf("\n*** original string ***In");puts (str);ch=str [0];for (i=0;【 】; i++)str [i]=str [i+1];【 】;printf("\n *** new string ***\n");puts (str);}

请补充函数fun(),该函数的功能是:把字符下标能铍2或3整除的字符从字符串str中删除,把剩余的字符重新保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。例如,输入“abcdefghijk”,输出“bfh”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80void fun(char s[], int n){int i, k;【 】;for(i=0; i<n; i++){s[k++]=s[i];if(【 】)k--;}【 】;}main(){int i=0,strlen=0;char str[N];clrscr();printf("\nInput a string:\n");gets(str);while(str[i]!='\0'){strlen++;i++;}fun(str,strlen);printf('\n*** display string ***\n");puts(str);}

请补充main()函数,该函数的功能是:把一个二维字符数组每行字符串中最大的字符复制到字符数组s中。例如,如果arr[3]={″hoih″,″yufui″,″xgf″),则str=″oyx″。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填人所编写的若干表达式或语句。试题程序:

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存在字符串str中,字符串str从键盘输人,其长度作为参数传人fun()函数。例如,输入“abcdef”,则输出“bdf”。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在mare()函数的横线上填入所编写的若干表达式或语句。试题程序:

请补充函数proc(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。例如,str1=”I am a”,str2=”student”,结果输出:I am a student。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序:

请补充函数proc(),该函数的功能是:把字符串str中的字符按字符的ASCⅡ码升序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传人。例如,如果输入“9fedcba”,则输出为“abcdefg”。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序: