首页 C程序设计实验报告

C程序设计实验报告

举报
开通vip

C程序设计实验报告C程序设计实验报告 《C程序设计》 实验报告 学 期: 班 级: 学 号: 姓 名: loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;、Reviewed by: date of ...

C程序设计实验报告
C程序设计实验报告 《C程序设计》 实验报告 学 期: 班 级: 学 号: 姓 名: loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;、Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no-loan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top line opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellation-I did not use the loan amount, your bank credit lines to be cancelled. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-unused credit lines, agree to write off loans. -Credit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day year contract number self-service card-I do not use credit, your bank credit lines to be cancelled. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-unused credit lines, agree to write off loans. -Credit loan principal repayment, agree to write off loans. Customer Manager signature: 实验1 熟悉C语言程序的运行环境,掌握数据描述 班 级 学 号 实 验 室 专 业 姓 名 成绩评定 所用软件 计算机号 教师签名 1.1 实验目的 1(了解在开发环境中如何编辑、编译、连接和运行一个C语言程序。 2(通过运行简单的C语言程序,初步了解C语言程序的结构特点。 3(掌握C语言数据类型的概念,学会使用C语言的相关运算符构成表达式。 1.2 实验预习 1(熟悉Visual C++的启动和退出及Visual C++中的编辑、编译、连接和运行命令。 2(了解下列命令及函数:include、main、printf、scanf。 3(熟悉Visual C++环境下每个菜单项的功能及相关命令对应的操作。 4(各种数据类型变量的定义形式及取值范围;熟悉下列标识符的含义。 int、short (int)、long (int)、unsigned (int)、float、double、char、void 5(各类运算符的优先级和结合规则。 (常量与变量的区别和联系。 6 运行环境: 1(双击桌面Visual C++快捷方式进入Visual C++,或通过执行“开始——>程序——> Microsoft Visual Studio 6.0——> Microsoft Visual C++6.0”或执行文件"C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\MSDEV.EXE"。 2(单击“文件”菜单的“新建”命令。 3(在打开的“新建”对话框中选择“文件”标签。 4(选择C++ Source File,在目录输入栏选择文件保存位置,然后在文件输入栏中输入文件名,扩展名为.c (例如first.c) ,单击确定按钮。如图所示: year cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co1rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. -service card-ontract number self 5(在源窗口中输入源程序,如图所示。 6(编译程序:按“Ctrl+F7”或通过“编译”菜单中的“编译”命令,或使用工具栏中的相 应工具进行编译 编译 连接 运行 若程序有错则找到出错行修改程序。 7(连接:若程序没有语法错误,则可按功能键,,或执行“编译”菜单中的“构件”命令 或通过工具栏中的相关工具(编译工具右边工具),进行连接生成可执行文件。 8(运行程序:按组合键“Ctrl+F5”,或通过“编译”菜单中的执行命令,或通过工具栏中 的“~”工具运行程序。 1.3 实验任务 1(输入下面的程序,注意区分大小写。 #include main() { printf(“I am a student!”); } 2. 预测结果并上机验证 人工分析结果 实验运行结果 #include main() { printf(“************\n”); printf(“I am a student!\n”); printf(“************\n”); -ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 2Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date } 3(预测结果并上机验证 人工分析结果 实验运行结果 #include #include main() { int a,b,sum; scanf(“%d,%d”,&a,&b); sum=a+abs(b); printf(“a add b is %d”,sum); } 4(预测结果并上机验证 (1) main() { int a,b; a=b=3; ,a,b); printf(“a=%d,b=%d” } (2)若将以上程序进行改写,编辑如下: main() { int a,b; a=3; b=3.1; printf(“a=%d,b=%d”,a,b); } 题号 人工分析结果 实验运行结果 (1) (2) 由此知,若赋值号左右数据类型不一致时,c语言将 5(现有程序如下,分析填空: 人工分析结果 实验运行结果 1 main() 2 { unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co3rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. -service card-ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s- 3 int a=1,b=2; 4 printf(“%d”,(a=a+b,b=b+a)); 5 } 若将以上程序第4行进行改写,编辑如下: printf(“%d”,a=a+b,b=b+a); 人工分析结果 实验运行结果 对比以上两程序,结果不同的原因在于 6(若有以下程序段,分析c2的值: int c1=2,c2; c2=1.0/c1*c1; 人工分析结果 实验运行结果 若将程序段改为: c2=1/c1*c1; 人工分析结果 实验运行结果 分析c2所得结果,其中的关键在于 7(现有程序如下: main() { int a=7, b=10; a=a+b; b=a-b; a=a-b; printf(“%d,%d\n”, a, b ); } 程序运行的功能是: 注:可修改a、b两数的值仔细观察。 8. 现有程序如下,分析填空: 人工分析结果 实验运行结果 main() { int a=0; a+=(a=8); printf("%d\n",a); } 9. 现有程序如下,分析填空: 人工分析结果 实验运行结果 unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 4Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. - main() { int a=2,b=5; int m=3,n; double c=2.1,d=4.5; n=a/m+b*c-d/m; printf(“%d”,n); } 10.现有程序如下,分析填空: 人工分析结果 实验运行结果 main() { int x=1,y=2; printf(“%d %d\n”,++x,y++); } 11.现有程序如下,分析填空: 人工分析结果 实验运行结果 main() { int x,y,z=0; x=y=1; z+=x+=y; x=z++; y=++x; z=x+++y; printf(“x=%d,y=%d,z=%d”,x,y,z); } 12.思考题:改错题(以下程序有多处错误,上机调试。将正确的程序记录在下方。要求不 能删减已有内容。) #include 正确的程序应改为: #define STA 30 main() {int a,b=3; A=3*PI*SIN(b); STA=3*STA; printf(“%d\n”,2a); printf(“%d”,b); } 1.4 实验心得 -unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co5rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. -service card-ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s 实验2 顺序结构程序设计与调试 班 级 学 号 实 验 室 专 业 姓 名 成绩评定 所用软件 计算机号 教师签名 2.1 实验目的 1(熟悉C语言的表达式语句、空语句和复合语句。 2(熟悉函数调用语句,尤其是各输入输出函数的调用语句。 3(熟悉顺序结构程序中语句的执行过程。 4(熟悉程序的跟踪调试和变量值的监视。 5(能设计简单的顺序结构程序。 2.2 实验预习 1(熟悉下列函数:putchar、getchar、printf、scanf 2(了解顺序结构程序的执行过程。 3(了解程序的跟踪调试和变量值的监视并能够熟练操作。 单步跟踪调试(逐条语句跟踪调试): 1)可按功能键F7进行,要监视某变量的值时,就按Ctrl,F7键,然后输入相应的 ( 变量名,就可以在监视消息窗口中查看到该变量的值。 (2)也可逐段运行程序,即每次运行若干条语句。首先利用Ctrl,F8键在各行光标 处设置若干断点,然后按Ctrl,F9键从程序的第一条语句运行到设置的第一个断 点,再按Ctrl,F9键从设置的第一个断点运行到设置的第二个断点。 4(了解顺序结构程序的一般构成。 2.3 实验任务 1(若有程序 main() { int i,j; scanf("i=%d,j=%d",&i,&j); printf("i=%d,j=%d\n ",i,j); } Credit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 6Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of record 要求给i赋5,给j赋10,则应该从键盘输入 52(华氏温度,要求输出摄氏温度,公式为:C=。要求输出结果保留到小数(f,32)9 点后两位。已知程序段中有三处错误,由注释语句/**********found**********/提示下一条语句有错误,请修改程序中的错误并记录程序运行结果。 错误原因是 正确语句是 #include main() { float f,c; clrscr(); /**********found(1)**********/ scanf("%d",f); /**********found(2)**********/ c=5/9(f-32); /**********found(3)**********/ printf("f=%f,c=%f\n",c,f); } 3. 已知程序功能是通过用户输入三角形三边,求取三角形面积。填空,将程序补充完整。 求取公式为;S=(a+b+c)/2 area=sqrt(s*(s-a)*(s-b) *(s-c)) 人工填空 上机填空 #include (1) /*需要添加头文件*/ main() {float a,b,c,s,area; clrscr(); scanf("%f,%f,%f",&a,&b,&c); (2); area=sqrt(3); /*库函数 sqrt的含义是开平方*/ printf("area=%f\n",area);} 4.单步跟踪下面程序的执行,每执行一条语句就查看各变量的值。运行时输入一个三位的整数。单步跟踪程序时填写下表,同时分析程序的功能。 #include”stdio.h” ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co7rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. -service card- void main() {int n,x1,x2,x3,y; printf(“please input number n”); scanf(“%3d”,&n); x1=n/100; x2=n/10%10; x3=n%10; y=x3*100+x2*10+x1; printf(“y=%3d”,y);} n X1 X2 X3 y 程序的功能是: 5. # include void main( ) { char ch; ch=getchar(); putchar(ch); } 运行时如果从键盘输入数据98,你预测的输出结果是 实际的输出结果为 原因在于 6. # include void main( ) { int a,b,c; scanf(“%d,%o”,&a,&b); c=a*b; printf(“%d,%o\n”,c,c); } 运行时如果输入数据:12,12 你预测的结果是 ,实际的输出结果是 。 7. # include void main( ) { int x,n1,n2,n3,y; scanf("%3d", &x); Credit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 8Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: date n1=x/100; n2=x/10%10; n3=x%10; y=n3*100+n2*10+n1; printf(“%d\n”,y); } 上述程序在运行时如果从键盘输入数据8265,则x的值为_______ 输出的结果为__________ , 在变量n1、n2、n3中,_____是x的百位数,_____是x 的十位数,_____是x的个位数。 8. #include void main( ) { int a=123, b=-45; float x=2.54729; printf(“a=%d,%2d,%5d,%-5d,%+5d\n”, a,a,a,a,a); printf(“b=%d,%2d,%5d,%-5d,%+5d\n”, b,b,b,b,b); printf(“x=%f,%9f,%9.2f\n”, x,x,x); printf(“x=%-7.3f,%2.2f,%.0f\n”, x,x,x); } 在下面写出程序的运行结果,每个空格用一个_来表示 || 9.编辑程序,输入学生语、数、英三门课程成绩(考虑数据类型,整型和实型),并输出其总分和平均分。 2.4 实验心得 Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. -service card-ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co9rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. - 实验3 选择结构程序设计与调试 班 级 学 号 实 验 室 专 业 姓 名 成绩评定 所用软件 计算机号 教师签名 3.1 实验目的 1(理解C语言表示逻辑量的 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 (以0代表“假”,以非0代表“真”)。 2(学会正确使用逻辑运算符和逻辑表达式、关系运算符和关系表达式。 3(学会运用逻辑表达式或关系表达式等表达条件。 4(熟练掌握if语句和switch语句。 5(学习跟踪调试程序,针对具体程序组织输入测试数据,观察程序运行能否得到预期 的输出结果。 6(熟悉选择结构程序段中语句的执行过程。 3.2 实验预习 1(熟悉逻辑运算符和逻辑表达式、关系运算符和关系表达式。 2(熟悉下列语句:if、if-else、switch、break。 3.3 实验任务 1(阅读程序,上机调试并记录程序结果。 人工分析结果 实验运行结果 #include main( ) { int x=0; if(x==0) printf("x=%d\n",x); else printf("x=%d\n,x+1); } #include main( ) { int x=0; clrscr(); if(x=0) printf("x=%d\n",x); else printf("x=%d\n,x+1); } -n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 10Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card 以上两题告诉了你什么: 2(阅读程序,上机调试并记录程序结果。 人工分析结果 实验运行结果 实验告诉我们 main() { int a=4,b=3,c=5,t=0; if(ab>c); printf("%d\n",d); } 4.若从键盘输入58,判断以下程序输出的结果。 人工分析结果 实验运行结果 main() { int a; scanf("%d",&a); if(a>50) printf("%d",a); if(a>40) printf("%d ",a); if(a>30) printf("%d ",a); } 5. 阅读程序,上机调试并记录程序结果。 人工分析结果 实验运行结果 main() { int x=1,a=0,b=0; switch(x) { case 0: b++; case 1: a++; case 2: a++;b++; year cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co11rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. -service card-ontract number self } printf(“a=%d,b=%d\n ”,a,b); } 6. 阅读程序,上机调试并记录程序结果。 人工分析结果 实验运行结果 main() { int a=13,b=21,m=0; switch(a%3) { case 0:m++;break; case 1:m++; switch(b%2) { default:m++; case 0:m++;break; } } printf(“m=%d\n”,m); } 7. 阅读程序,上机调试并记录程序结果。 人工分析结果 实验运行结果 实验告诉我们 main() { int i=1,j=1,k=2; if((j++||k++)&&i++); printf("%d,%d,%d\n",i,j,k); } 8. 阅读程序,并回答问题 main( ) { int a,b,max,min; scanf("%d%d",&a,&b); if(a>b) max=a; else max=b; printf("max=%d\n",max); } 问题: a、此程序的功能是 b、请用条件表达式语句(?:)修改程序使之完成相同的功能, unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 12Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. - 其语句是 9. 有一函数 x-1 (x<1) y = 2(x-1) (1<=x<10) 3x-10 (x>=10) 编程求当分别输入x的值为0.3,3.9,11时,y的值。 10.编辑程序,输入一个不多于3位的正整数,要求: a)求出它是几位数;分别打印出每一位数字; b)按逆序打印出各位数字,例如原数为321,应输出123。 11. 随机输入3个整型数据作为学生的课程成绩,编程实现由小到大排序输出(对比第三章编程题,比较他们的优缺点)。 3.4思考 请思考如何通过改变分支条件将多if嵌套变成无套形式,提高计算机的运算效率。请上网搜索答案,体会程序优化的思路方式。无具体答案。 I do not use credit, your bank credit lines to be cancelled. -service card-ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co13rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date- 3.5 实验心得 Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 14Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio 实验4 循环结构程序设计 班 级 学 号 实 验 室 专 业 姓 名 成绩评定 所用软件 计算机号 教师签名 4.1 实验目的 1(掌握用while语句、do-while语句和for语句实现循环的方法。 2(理解循环结构程序段中语句的执行过程,进一步练习程序的跟踪调试技术。 3. 掌握在程序设计中用循环的方法实现各种算法(如穷举法、迭代等)。 4. 理解break语句和continue语句的功能和执行过程。 4.2 实验预习 1(熟悉语句:while、do-while、for 、break、continue。 2(熟悉三种循环语句之间的关系和区别。 4.3 实验任务 (一)while循环 1(若输入的值是5,预测结果并上机验证 人工分析结果 实验运行结果 main() { int i,n; scanf("%d",&n); i =1; while(i<=n) i++; printf("i=%.d\n",i); } 2(若输入的值是5,预测结果并上机验证,循环执行次数是________,考虑若x定义为整型,程序结果是否相同__________ ,为什么___________________________________________ 人工分析结果 实验运行结果 main() { int i,n; double x,s=0; scanf("%d",&n); i=1;x=1; while(i<=n) {i++;x=x+1; s+=1/x; } printf("s=%.2f\n",s); } -I do not use credit, your bank credit lines to be cancelled. -service card-ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co15rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date 3. 阅读程序,完成下表,程序实现:1+2+„+100 main() {int n,s; n=____1___; s=____2___; while(___3___) {s+=_____4____; n++;} printf(“1+2+„+%d=%d\n”,100,_____5___);} 填空位置 人工填空语句 实验填空语句 (1) (2) (3) (4) (5) 4. 预测结果并上机验证 人工分析结果 实验运行结果 main() { int k,num,sum; sum=num=0; k=3; while (k<=10) {if(k%2==1) {sum+=k; num++;} k++;} printf("sum=%d,num=%d\n",s um,num); } (二)do„while循环 1. 预测结果并上机验证 人工分析结果 实验运行结果 main() { int x=0,y=5,z=3; do y = y-1; while(z-->0&&++x<5); printf(“%d,%d,%d\n”, x,y,z); } 2. 输入一串字符串,以字符“#”表示输入结束。统计其中大写字母与小写字母各出现 了多少次。 form 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of recordCredit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 16Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number self (三)for语句 1. 预测结果并上机验证 人工分析结果 实验运行结果 main() { char a,b; for(a=’0’,b=’4’;a main() { int x=14; while(x>10&&x<50) { x++; if(x/3){x++;break;} else continue;} printf(“%d\n”,x); } 2. 预测结果并上机验证 人工分析结果 实验运行结果 #include main() { int i=0,a=0; while(i<20) { for(;;) { if((i%10)==0) break; else i--; } i+=11; a+=i;} printf("%d\n",a); } service card-ontract number selfyear cd cancellation application form name of borrower ID number and credit limit expiration date year month day to year month day ignature: date case, agree to write off loans. Loan review signature: date of record form 16: qilu self credit for credit carCredit loan principal repayment, agree to write off loans. Customer Manager s-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-redit lines to be cancelled. I did not use the loan amount, your bank c-gnature: date agreed to open credit lines. Loan review signature: date line cancellationk opened credit lines above, is hereby requested. Borrower signature: date agreed to open credit lines. Customer Manager sier of years in the loan contract are the top line opened, the borrowed and requested your banloan borrowers: borrowers: ... Borrower name number, line of credit expiry date year month day to year month day maximum numb-years of maximum amount a maximum no Reviewed by: date of record form 9: qilu bank borrowing by single、ntract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the contract is correct; 3, in line with the co17rincipal repayment, agree to write off loans. Customer Manager signature:Credit loan p-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-I do not use credit, your bank credit lines to be cancelled. - 3. 阅读程序,完成下表,程序实现: 在屏幕上输出1~10之间的所有偶数 main() { int x=1; 填空位置 人工填空语句 实验填空语句 for(;;) {if(x>10) _1_; (1) x++; if(x%2) _2_; (2) printf(“%d”,x);} } (五)循环嵌套 1. 预测结果并上机验证 人工分析结果 实验运行结果 main() { int i,j,m=0; for(i=2;i<=10;i+=4) for(j=3;j<=15;j+=4) m++; printf(“%d\n”,m);} 2. 预测结果并上机验证 人工分析结果 实验运行结果 main() {int i,j; for(i=1;i<4;i++) {for(j=i;j<4;j++) printf(“%d*%d=%d”,i,j,i*j); printf(“\n”);} } (六)常见题型 1.两段程序均完成求和运算: s=1-1/3+1/5-1/7+...+1/99,阅读程序,完成填空 main() {int flag; float i,s; for(i=1,s=0,flag=1;i<=99;i+=2) { s=s+_____1______; flag=-flag;} printf("%f",s);} main() { float n,s; for(s=0,n=1;n<=50;n++) {s=s+_______2________;} printf("%f",s);} Credit loan principal repayment, agree to write off loans. Customer Manager signature: date case, agree to write off loans. -unused credit lines, agree to write off loans. -es to be cancelled. Borrower signature: dateCredit loan principal repayment, your bank credit lin-I did not use the loan amount, your bank credit lines to be cancelled. -tiono open credit lines. Customer Manager signature: date agreed to open credit lines. Loan review signature: date line cancellareed tine opened, the borrowed and requested your bank opened credit lines above, is hereby requested. Borrower signature: date agumber, line of credit expiry date year month day to year month day maximum number of years in the loan contract are the top lloan borrowers: borrowers: ... Borrower name n-Reviewed by: date of record form 9: qilu bank borrowing by single years of maximum amount a maximum no、contract is correct; 3, in line with the contract, payment; 4, no other major cases against loan security;loan management (post) review: 1, approval criteria have been implemented; 2, the 18Credit loan principal repayment, agree to write off loans. Customer Manager signature:-unused credit lines, agree to write off loans. -Credit loan principal repayment, your bank credit lines to be cancelled. Borrower signature: date-ancelled. I do not use credit, your bank credit lines to be c-service card-n date year month day to year month day year contract number selfform 16: qilu self credit for credit card cancellation application form name of borrower ID number and credit limit expiratio Loan review signature: date of record 填空位置 人工填空语句 实验填空语句 (1) (2) 11112.完成计算。数列表达式s=1++++„+,当n=10时,求s的近似值。已知程序段中234n 有两处错误,由注释语句/**********found**********/提示下一条语句有错误,请修改程序中的错误 并记录程序运行结果。 #include main( ) {float s=0; int n; /**********found**********/ for(n=1,n<=10,n++) /**********found**********/ s=s+1/n; printf("s=%f\n",s); } 修改程序中的错误并记录程序运行结果。 错误位置 正确语句形式 实验运行结果 (1) (2) 3. 求3,150之间的所有素数。 #include #include main() {int s=0,i,n,flag; for(i=3;i<=150;i++) {flag=0; /*语句功能:(1)*/ for(n=2;(2);(3)) /*表达式功能:判断某个数是否是素数,给出判断区间*/ if(i%n==0) {flag=1; break;} if(flag==0) s=s+i; } printf("s=%d\n",s);} 19 填空位置 人工填空语句 实验填空语句 实验运行结果 1 2 3 4.以下程序的功能是输出100以内能被3整除且个位数为6的所有整数,请填空补充完整。 main() {int i,j; for(i=0;_______________;i++) {j=i*10+6; if(_______________) continue; printf(“%d”,j);} } 填空位置 人工填空语句 实验填空语句 实验运行结果 1 2 5. 编程实现九九乘法表。 4.4 实验心得 20 实验5 函数定义、调用与编译预处理 班 级 学 号 实 验 室 专 业 姓 名 成绩评定 所用软件 计算机号 教师签名 5.1 实验目的 1(掌握定义函数的方法。 2(掌握函数实参与形参的对应关系,以及“值传递”的方式。 3(了解函数的嵌套调用。 4(掌握全局变量和局部变量,动态变量和静态变量的概念和使用方法。 5(理解宏的概念,掌握宏定义。 6(了解文件包含的概念。 5.2 实验预习 1(函数的概念、定义格式、声明格式、调用规则及调用过程中数据传递方法过程,函 数的嵌套调用和递归调用。 2(宏定义和文件包含等编译预处理指令。 5.3 实验任务 1. 预测结果并上机验证 人工分析结果 实验运行结果 #include fun(int x, int y, int z) { z=x*x+y*y; } main() { int a=31; fun(5,2,a); printf(“%d”,a); } 2.预测结果并上机验证 人工分析结果 实验运行结果 #include int a, b; void fun() { a=100; b=200; } main( ) { int a=5, b=7; fun(); printf(“%d,d \n”, a,b); } 21 3.预测结果并上机验证 人工分析结果 实验运行结果 #include int f(int n) { if(n==1) return 1; else return f(n-1)+1; } main() { int i,j=0; for(i=i;i<3;i++) j+=f(i); printf(“%d\n”,j); } 4.预测结果并上机验证 人工分析结果 实验运行结果 #include int ff(int n) { static int f=l; f=f*n; return f; } main() { int i; for(i=1;i<=5;i++ ) printf(“%d\n”,ff(i)); } 5.预测结果并上机验证 人工分析结果 实验运行结果 #include #define N 10 #define s(x) x*x #define f(x) (x*x) main() { int i1,i2; i1=1000/s(N);i2=1000/f(N); printf(“%d%d\n”,i1,i2); } 6.程序填空 定义两个函数,分别求两个整数的最大公约数和最小公倍数,用主函数调用这两个函数, 并输出结果。两个整数由键盘输入。 #include 22 int f1(int m,int n) /*填空位置(1),函数功能:____________________。*/ {int z; for(z=m;z<=m*n;z++) { if((z%m==0)&&(z%n==0)) return z; } } main() {int m,n,t,s,q; ____________________; /*填空位置(2)*/ scanf("m=%d,n=%d",&m,&n); if(m main() { char s[]="abcdef"; s[3]=‘\0'; printf("%s\n",s); } 2.预测结果并上机验证 人工分析结果 实验运行结果 #include main(){int a[4][4]={{1,2,-3,-4},{0,-12,-1 3,14} ,{-21,23,0,-24},{-31,32, -33,0}}; int i,j,s=0; for(i=0;i<4;i++) 25 { for(j=0;j<4;j++) {if(a[i][j]<0) continue; if(a[i][j]==0) break; s+=a[i][j]; } } printf("%d\n",s); } 3.预测结果并上机验证 人工分析结果 实验运行结果 #include main(){ char ch[3][5]={"AAAA","BBB" ,"CC"}; char s[]="\\141\141abc\t"; printf ("%s\n",s); printf("\"%s\"\n",ch[1]); } 4.预测结果并上机验证 人工分析结果 实验运行结果 #include main() { char a[]={‘a’,‘b’, ‘c’,‘d’,‘e’,‘f’,‘g’,‘h ’,‘\0’}; int i,j; i=sizeof(a);j=strlen(a); printf(“%d,%d\b”i,j); } 5(程序填空 (1)在有序数据序列中插入一个数据,插入后仍然保证数据序列的有序性。 原始数据序列为:{5,8,12,15,26,78,92,93,102},需要插入的数据值为25。 算法思想:(1)通过比较,确定需要插入的位置。 (2)从插入位置开始,所有数据依次右移(后移)1位,然后将数据插入 到确定的位置上。 #include #define N 10 int a[N]={5,8,12,15,26,78,92,93,102}; 26 main() { int i,j,k,data=25; clrscr(); for(i=0;i=k;j--) for(j=N- _______________; /*填空位置(2),插入位置之后所有元素依次右移1位*/ _______________; /*填空位置(3),将指定的数据插入到有序序列中*/ for(i=0;i<=N-1;i++) printf("%5d",a[i]); } 填空位置 人工填空语句 实验填空语句 1 2 3 实验运行结果 (2) 计算矩阵边界元素的和。 1 2 3 4 5 6 7 8 9 10 11 12 #include 13 14 15 16 #define M 4 #define N 4 int a[M][N]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; main() {int i,j,s=0; for(i=0;i<=M-1;i++) for((1)__________;(2)__________;j++) if((3)____________________) s=s+a[i][j]; printf("sum=%d\n",s); } 填空位置 人工填空语句(或表达式) 实验填空语句(或表达式) 1 2 3 实验运行结果 27 3(编程题: (1)编辑程序,将用户输入的任意字符串中的数字字符全部删除,形成新的字符串输出。 (2) 输入n个学生成绩,计算他们的平均值并输出所有高于平均成绩的学生成绩。 4.综合题: 从键盘输入10个数,然后,按由大到小的次序将它们显示到屏幕上。 要求: 1. 利用顺序排序法实现排序,写出程序; 28 2. 利用选择排序法实现排序,写出程序; 3. 利用冒泡排序法实现排序,写出程序; 6.4 实验心得 29 实验7 综合程序设计:综合运用C语言基本知识设计程序 班 级 学 号 实 验 室 专 业 姓 名 成绩评定 所用软件 计算机号 教师签名 7.1 实验目的 通过本次实验,使学生能够灵活运用所学知识,完成程序设计,进一步提高程序设计 的能力。 7.2 实验预习 1(复习函数的相关知识。 2(复习数组的相关知识。 7.3 实验任务 1. 餐饮服务质量调查打分 在商业和科学研究中,人们经常需要对数据进行分析并将结果以直方图的形式显示出来。例如,一个公司的主管可能需要了解一年来公司的营业状况,比较一下各月份的销售收入状况。如果仅给出一大堆数据,这显然太不直观了,如果能将这些数据以条形图(直方图)的形式表示,将会大大增加这些数据的直观性,也便于数据的分析与对比。下面以顾客对餐饮服务打分为例,练习这方面的程序编写方法。假设有40个学生被邀请来给自助餐厅的食品和服务质量打分,分数划分为1,10这10个等级(1表示最低分,10表示最高分),试统计调查结果,并用*打印出如下形式的统计结果直方图。 Grade Count Histogram 1 5 ***** 2 10 ********** 3 7 ******* ... 2. 大奖赛现场统分 以往各类大奖赛的报分与统分脱节,参赛选手的最后得分总要等到下一个选手赛完后才报,影响竞赛的正常节奏,也不能满足观众的期待心理。现在请你为某大奖赛编写一个现场统分的程序,在各评委打分之后,及时通报评分结果。 已知:某大奖赛有n个选手参赛,m(m>2)个评委为依次参赛的选手评判打分:最高100分,最低0分。统分规则为:每个选手所得的m个得分中,去掉一个最高分,去掉一个最低分,然后平均为该选手的最后得分。要求编程:根据n个选手的最后得分,从高到低排出名次表,以便确定获奖名单。 30 提示:设置数组sf[i]为第i个选手的最后得分。pf[i][j]为第j个评委给第i个选手的评分。 对n个参赛选手设置i循环(i从1变化到n):第i个选手上场,在j循环(j从1变化到m)中依次输入第i个选手的m个得分pf[i][j],每一个得分pf[i][j]都进行累加,去掉一个最高分max,去掉一个最低分min,第i个选手的最后得分于是为:sf[i] = (sf[i] – max – min) / (m - 2)(2)n个参赛选手的最后得分sf[0]、sf[1]、„、sf[n]全部计算完后,将其从高到低排序,输出打印参赛选手的名次表。 7.4 实验报告 1(写出完整的程序源代码 清单 安全隐患排查清单下载最新工程量清单计量规则下载程序清单下载家私清单下载送货清单下载 。 2(写出完整的程序源代码清单。 31 7.5 实验心得 32
本文档为【C程序设计实验报告】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_477730
暂无简介~
格式:doc
大小:156KB
软件:Word
页数:55
分类:生活休闲
上传时间:2017-10-22
浏览量:97