A.財物的收發、增減和使用
B.債權債務的發生和結算
C.制定企業年度財務計劃
D.收入、支出、費用、成本的計算
第1題
在文件IN6.DAT中有200個正整數,且每個數均在1000至9999之間。函數readDat()的功能是讀取這200個數存放到數組aa中。請編制函數jsSort(),該函數的功能是:要求按每個數的后3位的大小進行降序排列,將排序后的前10個數存入數組b中,如果數組b中出現后3位相等的數,則對這些數按原始4位數據進行升序排列。最后調用函數writeDat()把結果bb輸出到文件OUT6.DAT中。
例如:處理前 9012 5099 6012 7025 8088
處理后 5099 8088 7025 6012 9012
注意:部分源程序已給出。
請勿改動主函數main()、讀函數readDat()和寫函數writeDat()的內容。
第2題
在文件IN3.DAT中有200個正整數,且每個數均在1000至9999之間。函數addat()的功能是讀取這200個數存放到數組aa中。請編制函數JsSorr(),該函數的功能是:要求按每個數的后3位的大小進行降序排列,將排序后的前10個數存入數組b中,如果數組b中出現后3位相等的數,則對這些數按原始4位數據進行升序排列。最后調用函數wiltedat()把結果bb輸出到文件 OUT3.DAT中。
例如:處理前 9012 5099 6012 7025 8088
處理后 5099 8088 7025 6012 9012
注意:部分源程序已給出。
請勿改動主函數main()、讀函數readDat0和寫函數writeDat()的內容。
試題程序:
include <stdio.h>
include <string.h>
include <conio.h>
int aa[200], bb[10];
void jsSort()
{
}
main()
{
readDat ();
jsSort ();
writeDat();
}
readDat ()
{
FILE *in;
int i;
in = fopen("IN3.DAT", "r");
for(i = 0; i < 200; i++) fscanf(in, "%d,", &aa[i]);
fclose(in);
}
writeDat()
{
FILE *out;
int i;
out = fopen("OUT3.DAT", "w");
clrscr();
for (i = 0; i < 10; i++)
{
printf("i=%d,%d\n", i+1, bb[i]);
fprintf(out, "%d\n", bb[i]);
}
fclose(out);
}
第3題
在文件in33.dat中有200個正整數,且每個正整數均在1000至9999之間。函數readDat()的功能是讀取這200個數并存放到數組aa中。請編制函數jsSort(),該函數的功能是:要求按照每個數的后3位的大小進行升序排列,將排序后的前10個數存入數組bb中,如果數組bb中出現后3位相等的數,則對這些數按原始 4位數據進行降序排列,最后調用函數writeDat()把結果bb輸出到文件out33.dat中。
例如:處理前6012 5099 9012 7025 8088
處理后9012 6012 7025 8088 5099
注意:部分源程序已給出。
請勿改動主函數main()、讀函數readDat()和寫函數writeDat()的內容。
試題程序:
include<stdio. h>
include<string. h>
include<conio. h>
int aa[200] ,bb[10];
void readDat ();
void writeDat();
void jsSort()
{
void main ()
{
readDat ();
jsSort ();
writeDat ();
}
void readDat ()
{
FILE *in;
int i;
in=fopen ("in33 .dat" , "r" );
for(i=0;i<200;i++) fscanf (in, "%d ".&aa[i]);
fclose (in);
}
void writeDat ()
{
FILE *out;
int i;
clrscr ();
ut =fopen ("out33 .dar" , "w" );
for (i=0; i<10; i++)
{
printf ("i=%d, %d\n", i+1, bb[i] ;
fprintf (out, "%d\n" ,bb[i] );
}
fclose (out);
}
第4題
在文件in33.dat中有200個正整數,且每個正整數均在100至9999之間。函數readDat()的功能是讀取這 200個數并存放到數組aa中。請編制函數jsSort(),該函數的功能是:要求按照每個數的后3位的大小進行升序排列,將排序后的前10個數存入數組bb中,如果數組比中出現后3位相等的數,則對這些數按原始4位數據進行降序排列。最后調用函數writeDat()把結果比輸出到文件out33.dat中。
例如:處理前6012 5099 9012 7025 8088
處理后9012 6012 7025 8088 5099
注意:部分源程序已給出。
請勿改動主函數main()、讀函數readDat)和寫函數writeDat()的內容。
試題程序:
include
9include
include
int aa[200],bb[10];
void readDat();
void writeDat();
void jsSort()
{
}
void main()
{
readDat();
jsSort();
writeDat();
}
void readDat ()
{
FILE *in;
int i;
in=fopen (" in33. dat", "r" );
for(i=0;i<200;i++) fscanf (in,"%d ",&aa[i]);
fclose (in);
}
void writeDat()
{
FILE *out;
int i;
clrscr ();
out=fopen ("out33. dat", "w" );
for (i=0;i<10; i++)
{
printf ("i=%d, %d\n", i+l,bb [i] );
fprintf (out, "%d\n", bb [i] );
}
fclose (out);
}
第5題
第6題
第7題
已知在文件IN.dat中存有若干個(少于200個)四位數字的正整數,函數ReadDat()讀取這若干個正整數并存入數組number中。請編寫函數CalValue(),其功能要求是:①求出文件中共有的正整數個數totNum;②求這些數右移1位后,產生的新數是奇數的數的個數totCnt以及滿足此條件的這些數(右移前的值)的算術平均值totAve。最后調用函數writeDat()把所求的結果輸出到OUT.dat文件中。
注意:部分源程序已經給出。請勿改動主函數main()、讀函數ReadDat()和寫函數writeDat()的內容。
include <stdio.h>
include <conio. h>
define MAXNUM 200
int number [MAXNUM];
int totNum = 0; /* 文件IN.dst 中共有的正整數個數*/
int totCnt = 0; /* 符合條件的正整數的個數*/
double totAve = 0.0; /* 平均值 */
int ReadDat (void);
void writeDat(void);
void CalValue(void)
{
}
void main ()
{ int i;
for (i=0; i<MAXNUM; i++)
number [i] = 0;
if (ReadDat())
{ printf (" 數據文件 IN.dst 不能打開! \007\n");
return;
}
CalValue ();
printf(" 文件 IN.dst 中共有的正整數個數=%d個\n", totNum);
printf (" 符合條件的正整數的個數 =%d個\n", totCnt);
printf("平均值=%.2f\n", totAve);
writeDat ();
}
int ReadDat (void)
{ FILE *fp;
int i = 0;
if ((fp = fopen("IN.dat", "r")) == NULL)
return 1;
while (!feof(fp))
fscanf(fp, "%d,", &number [i++]);
fclose (fp);
return 0;
}
void writeDat (void)
{ FILE *fp;
fp = fopen("OUT.dat", "w");
fprintf(fp, "%d\n%d\n%6.2f\n", totNum, totCnt, totAve);
fclose (fp);
}
第8題
在文件in.dat中存有若干個(個數<200)四位數字的正整數,函數ReadDat讀取這若干個正整數并存入數組XX中。請編制函數CalValue,其功能要求:1.求出該文件中共有多少個正整數totNum;2.求出這些正整數中的各位數字之和是偶數的數的個數totCnt,以及滿足此條件的這些正整數的算術平均值totPjz。最后main函數調用函數WriteDat把所求的結果輸出到0ut.dat文件中。 注意:部分源程序存放在test.c文件中。 請勿改動數據文件in.dat中的任何數據,主函數main、讀函數ReadDat和輸出函數WriteDat的內容。
第9題
已知在in.dat中存有若干個(個數<200)四位數字的正整數,函數ReadDat讀取這若干個正整數并存入數組XX中。請編制函數CalValue,其功能要求: 1.求出該文件中共有多少個正整數totNum; 2.求這些正整數右移1位二進制位后,產生的新數是奇數的數的個數totCnt,以及滿足此條件的這些正整數(右移前的值)的算術平均值totPjz。最后main函數調用函數 WriteDat把所求的結果輸出到文件out.dat中。 注意:部分源程序存放在test.c文件中。 請勿改動數據文件in.dat中的任何數據,主函數main、讀函數ReadDat和輸出函數WriteDat的內容。
第10題
已知在文件IN.dat中存有若干個(少于200個)四位數字的正整數,函數ReadDat()讀取這若干個正整數并存入數組number中。請編寫函數CalValue(),其功能要求是:①求出文件中共有的正整數個數totNum;②求這些數右移1位后,產生的新數是奇數的數的個數totCnt以及滿足此條件的這些數(右移前的值)的算術平均值totAve。最后調用函數writeDat()把所求的結果輸出到OUT.dat文件中。
注意:部分源程序已經給出。請勿改動主函數main()、讀函數ReadDat()和寫函數writeDat()的內容。
include <stdio.h>
include <conio. h>
define MAXNUM 200
int number [MAXNUM];
int totNum = 0; /* 文件IN.dst 中共有的正整數個數*/
int totCnt = 0; /* 符合條件的正整數的個數*/
double totAve = 0.0; /* 平均值 */
int ReadDat (void);
void writeDat(void);
void CalValue(void)
{
}
void main ()
{ int i;
for (i=0; i<MAXNUM; i++)
number [i] = 0;
if (ReadDat())
{ printf (" 數據文件 IN.dst 不能打開! \007\n");
return;
}
CalValue ();
printf(" 文件 IN.dst 中共有的正整數個數=%d個\n", totNum);
printf (" 符合條件的正整數的個數 =%d個\n", totCnt);
printf("平均值=%.2f\n", totAve);
writeDat ();
}
int ReadDat (void)
{ FILE *fp;
int i = 0;
if ((fp = fopen("IN.dat", "r")) == NULL)
return 1;
while (!feof(fp))
fscanf(fp, "%d,", &number [i++]);
fclose (fp);
return 0;
}
void writeDat (void)
{ FILE *fp;
fp = fopen("OUT.dat", "w");
fprintf(fp, "%d\n%d\n%6.2f\n", totNum, totCnt, totAve);
fclose (fp);
}
為了保護您的賬號安全,請在“上學吧”公眾號進行驗證,點擊“官網服務”-“賬號驗證”后輸入驗證碼“”完成驗證,驗證成功后方可繼續查看答案!