C Language Programming Lab Report Content
1, the name of the experiment: calculate the sum of the 10 largest prime numbers within 1000.
2, the purpose of the experiment: proficiency in if, if…else, if…elseif statement and switch statement format and use, master the nesting relationship in the if statement and the matching principle, the use of if statement and switch statement to achieve branch selection structure. Master the while statement, do…while statement and for statement format and usage, master the looping process of the three kinds of looping control statements and the nesting of looping structure, and utilize the looping statement to realize the looping structure. Master simple, commonly used algorithms, and experience the programming skills of various algorithms in the programming process. Further learn to debug programs and master methods of checking for syntax errors and logical errors.
3. Experimental content: calculate and output the largest 10 prime numbers within 1000 and their sum.
4. Requirements: add necessary comments inside the program. Since even numbers are not prime, the treatment of even numbers can be disregarded. Although more than 10 prime numbers within 1000, but to deal with the case of not enough 10 prime numbers within 1000. The output is in the form: prime 1 + prime 2 + prime 3 + … + prime 10 = sum value.
5, the algorithm describes the flow: Main function: to determine the number of prime numbers:
6, the test data: respectively, input 1000, 100, 10 test.
7, running results: problems and solutions: when the number of prime numbers less than 10 is not perfect, not well thought out. Learning patience and lack of care, such as scanf (“%d”, &n);; in the “&” often forget.
9, the basic skills are not enough, such as clearing the screen clrscr () and other functions are not good, and sometimes the same problem many times, to the experimental class teacher to bring a lot of trouble. This shows that my knowledge is not broad enough, there are many useful but do not do the exam requirements of the book content did not learn well, the degree of understanding is not deep enough. Even in the future, after the end of the C language course, you should read more related things, more on-line practice, in order to really improve themselves from the essence.
10, Physics Lab Report – Chemistry Lab Report – Biology Lab Report – Lab Report Format – Lab Report Template
11, the knowledge is not extensive enough, such as VC + + 6.0 and other programs, try a good while to use their own can not be used; shows that I am still not enough level of computers, not enough ability to self-learning. What has been mastered is still not good enough.
12, experimental experience: through the C language on-line experiments, I have a certain experience of this between human and non-human computer programming language. During the happy, depressed, helpless, uncertain …… With the triumphant success of the experiment and the triumphant completion of the experimental report, a bit of a slight sense of pride to make people unforgettable. Thanks to Mr. Gao Keling’s high standards and strict requirements, thanks to the patience of the small teachers in the experimental class, but also thanks to the bits and pieces I experienced in the experiment …… Along with the deepening of the study, I found that there are still a lot of deep things, waiting for me to dig myself out. I will work harder on C language.
c language programming lab report
Fifth, the course design summary of the experience
1 design ideas
1), set a one-dimensional array, can be set first by the employee serial number of each employee’s salary
2), the use of While statement and Prinft statement to complete the design of the user’s menu
Functions: the first item is set to for the employee number and salary data
The second item is set to modify the employee salary data
The third item is set to query the employee salary data
The fourth item is set to the end of the system
3), when the user selects the 1, 2 items, the need to enter the employee number, so you need to design the number of the correction function, if an error can be output ” Theerroremployenumber”
4), when the choice of 2, wage data modification, and the new data will be saved back to the employee’s salary array
5), the use of for loop in the judgment statement, the user’s salary and the number of salaries in the array to compare, such as the same output, the counter will be added to 1, and so on, until the entire array traversed once
6), determine whether the counter is 0, is 0 that can not be found in line with the wage, if not 0, then the output of a total of several than the matching wage
The above of course, also involves the “modularity of the function” concept, which can be avoided, but the need to repeat the print header file. Repeatedly print the header file to repeat the preparation of the print header statement. Like this program is common, this not only reduces the program also sends the efficiency, but also time-consuming and waste of resources “common body” use to simplify the program’s “complexity”, as in (4), the school number and name at the same time to indicate a person, but in the function using the “common body”. “shared body”, so that the simplicity of the program can facilitate error correction, to find the problem, to avoid the repetition of the code, which brings a certain degree of difficulty to the compiler and the “amount” of complexity. Generally do not take this approach, and strive to “simple, clear, clear”.
How to write a summary of c language lab report
Summary of c language lab report is written in this way:
In today’s highly developed science and technology, the role of computers is becoming more and more prominent among people. And c language as a language of computer, we learn it, help us better understand the computer, communicate with the computer, so the learning of c language is especially important to us.
In this week, our majors had a practical study of c language program under the leadership of our professional teachers. Before this, we have been on the c language this course of study for a semester, have a certain understanding of it, but also just stay in the scope of understanding, a lot of things in it is still very unfamiliar, in the use of up to the time is still very tricky, after all, everything is difficult to begin with.
Because of the relationship between time, our practice course teacher did not give us a detailed introduction, just give us a simple introduction to a few more important practical operation. Including the program module processing. Simple interface program. Advanced interface program. Adding and modifying programs. The program to do one-way linear regression processing and the use of the C language program to draw the particle size distribution graph and so on these several more important time operation.
The on-line experiment is an essential practical part of learning programming language, especially c language is flexible and concise, it is more necessary to really master it through the practice of programming. For the purpose of learning the programming language can be summarized as learning the syntax of the provisions, mastering the program design methodology, improve program development capabilities, these must be completed through sufficient practical on-line operation.
Learning c programming language in addition to classroom lectures, must ensure that there is no less than the classroom lecture hours of computer time. Because of the time limit, the course can not arrange too many unified on-line experiments, so I hope that the students effectively use the opportunity of the course on-line experiments, as soon as possible to master the ability to develop programs with the c language, for the future to continue learning to lay a good foundation.
To this end, we have arranged 12 on-line experiments in conjunction with the content and progress of the classroom lectures. The purpose of the course on-line experiment, not only to verify the content of the textbook and lectures, check their own program is correct, the purpose of the course on-line experiment can be summarized in the following aspects:
1, to deepen the content of the classroom ‘s understanding
The classroom to teach a lot of rules about the syntax of the C language, it sounds very boring, it is not easy to memorize, the rote memorization is not desirable. Rote memorization is not desirable. However, in order to use the c language as a tool to solve practical problems, and must master it.
Through many on-line practice, for the grammatical knowledge has a perceptual awareness, deepen the understanding of it, in the understanding of the basis will naturally master the c language syntax regulations. For some of the content they think they understand in the classroom, but on-line practice will find that the original understanding of the deviation, this is due to the majority of students is the first contact with programming, the lack of programming practice due.
Learning the c language can not stay in the study of its syntax rules, but the use of knowledge learned to write c language program to solve practical problems. That is, the c language as a tool to describe the steps to solve practical problems, by the computer to help us solve the problem. Only through the computer can we test whether we have mastered the c language and whether the program we write can solve the problem correctly.
To verify the correctness of a program written by oneself through on-line experimentation is, I am afraid, the mindset of most of the students in completing the teacher’s homework. But in the field of programming this is a traditional and wrong idea that must be overcome. Because in this kind of thinking, you may try to “cover up” the errors in the program, instead of finding as many problems in the program as possible.
When you make up your own program and run it on the debugging machine, there may be a lot of things you can’t think of, and by solving these problems, you can gradually improve your understanding of the C language and your ability to develop your own program.
2, familiar with the program development environment, learning the operation of the computer system
A c language program from editing, compiling, connecting to run, are in a certain external operating environment. The so-called “environment” is the computer system hardware, software conditions, only to learn to use these environments, in order to carry out program development work.
Through the on-line experiment, skilled mastery of the c language development environment, for the future really write computer programs to solve practical problems to lay the foundation. At the same time, when encountering other development environment in the future will be touching, and quickly master the use of the new system.
3, learning to debug the program
Completion of the program, never means everything is fine. You think that a foolproof program, the actual machine may be constantly running trouble. For example, the compiler program detects a whole bunch of errors. Sometimes the program itself doesn’t have syntax errors, and it runs fine, but the results are clearly wrong.
The compilation system provided by the development environment is unable to detect such errors in program logic, so you have to rely on your own onboard experience to analyze and determine where the errors are. Program debugging is a very skillful work, for beginners, as soon as possible to master the program debugging method is very important. Sometimes a small error that consumes a few hours of your time can be seen by a debugging expert at a glance.
Through this few days of computer practice learning, we have learned some knowledge about the c language, understanding and consolidate our theoretical knowledge of the c language, which will help us to come to the social work will be of great help. At the same time, it lets me know that as long as you work hard, nothing is too difficult!
C language programming lab report how to write ah
Just an example, not to be copied.
Experiment content and requirements:
[Experiment content]
1, through this test preliminary development of computer logic problem solving ability. Skillfully grasp the application of assignment statements and if statements; master switch multiple branching statements and if nested statements
2, the basic data types, operators and expressions and other programming basics learned in the early stage of the application of specific program design.
3, further proficiency in input and output functions scanf, printf and getchar use, familiar with math.h in the use of common mathematical functions
4, master the application of the loop statement.
5. Understand the random number generation function.
[Experimental requirements]
In the specified period of time to complete the experiment independently
1, submitted to the experimental report (electronic)
2, submitted to the corresponding source program file (file name EX6_x name.c, such as EX6_1 Peng Jian.c)
3, the requirements of the simple to the complex, followed by the requirements of the previous basis for modification, the first six questions, the first six questions, the first six questions, the first six questions, and the first six questions. Modification, the first six questions, each question are required to retain their respective programs, six questions later, each question are modified on the basis of the previous question, retain the last program can be (such as to do the ninth question, then retain EX6_9 name.c, to do the 11th question, then retain ex6_11 name.c)
Second, the principle of the experiment and the design of the program:
1, the function header of the selection of the rules, while Loop statement, switch (case) statement, conditional expression, ifelse conditional statement, self-incrementing operator, set complex variables, output random operands.
2, variables to have a score variable and level variable, to have a variable to select the number of algorithmic questions and the calculation of the correct or incorrect variable, to have a random output of the two operand variable and their own results by the operation symbols input variable, and finally there is to determine whether to proceed with the variable character. The intermediate results are switch() for the selection operator and switch() for the grade of the score and the self-increment of the wrong pair of questions and the self-increment of the selection operator calculation.
3. The method of analyzing the problem: first consider setting the shaping variables and character variables, considering the need to constantly loop the calculation, choose to use the while statement to loop. In the body of the loop, the previous output prompt operator, and self-select operator, the answer and output random operands to complete. Then use the switch statement to judge the selected operator, and use the variable for self-incrementing operation, and calculate the number of wrong questions to the right questions and the kind of operation symbols selected. At the end of the loop body, an ifelse statement is used to determine whether to continue execution or to jump out of the loop. Finally, according to the results of the self-incrementing calculation and the formula for the calculation of scores, and use switch statement is to think of the development of the grade.
Three, source code
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
voidmain()
{
……….
}
Four, the results of the test and inspiration
Because the input y to continue the loop, so choose to use the while statement. The while statement should be combined with the previous calculation on cue and nested switch statement and use conditional expression to calculate the result is correct or not, and what type of question is calculated. Finally, the switch statement is used to complete the judgment of the score level.
V. Experimental experience:
Describe the difficulties and problems you encountered in programming or compiling and running the program and the solutions.
C语言程序设计实验报告
题目2:
#include<stdio.h>
#include<stdlib.h>
main()
{
inta;
printf(“ÇëÊäÈë³É¼¨£º\n”);
scanf(“%d”,&a);
if(90<=a&&a<=100)printf(“A”);
if(80<=a&&a<=89)printf(“B”);
if(70<=a&&a<=79)printf(“C”);
if(60<=a&&a<=69)printf(“D”);
if(0<=a&&a<=59)printf(“E”);
if(a>100||a<0)printf(“ÊäÈëÊý¾Ý³ö´í”);
getch();
}
switch:
#include<stdio.h>
main2()
{
inta;
printf(“ÇëÊäÈë³É¼¨:\n”);
scanf(“%d”,&a);
switch(a/10)
{
case10:printf(“A!\n”);
break;
case9:printf(“A!\n”);
break;
case8:printf(“B!\n”);
break;
case7:printf(“C!\n”);
break;
case6:printf(“D!\n”);
break;
case5:printf(“E!\n”);
break;
case4:printf(“E!\n”);
break;
case3:printf(“E!\n”);
break;
case2:printf(“E!\n”);
break;
case1:printf(“E!\n”);
break;
case0:printf(“E!\n”);
break;
default:
printf(“ÊäÈëÊý¾ÝÓдí\n”);
}
getch();
}
还有你第一题是什么意思呢
题目3:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main
()
{
inta,g,s,b,q,w,x,p,x1,x2,x3,x4;
printf(“ÇëÊäÈ룺\n”);
scanf(“%d”,&a);
/*ÅжÏλÊý*/
if(a<0||100000<a)printf(“Êý¾Ý³¬³ö·¶Î§£¡£¡£¡”);
elseif(a/10000!=0){printf(“5λÊý\n”);p=5;}
elseif(a/1000!=0){printf(“4λÊý\n”);p=4;}
elseif(a/100!=0){printf(“3λÊý\n”);p=3;}
elseif(a/10!=0){printf(“2λÊý\n”);p=2;}
elseif(a/1!=0){printf(“1λÊý\n”);p=1;}
/*·Ö±ð´òÓ¡³öÿһλÊý×Ö*/
w=a/10000;
printf(“ÍòλΪ%d\n”,w);
q=(a-w*10000)/1000;
printf(“ǧλΪ%d\n”,q);
b=(a-10000*w-1000*q)/100;
printf(“°ÙλΪ%d\n”,b);
s=(a-10000*w-1000*q-b*100)/10;
printf(“ʮλΪ%d\n”,s);
g=(a-w*10000-q*1000-b*100-10*s);
printf(“¸÷λΪ%d\n”,g);
/*°´ÄæÐò´òÓ¡³ö¸÷λÊý*/
if(p==5){x=g*10000+s*1000+b*100+q*10+w;printf(“µ¹ÐòÊýΪ%d\n:”,x);}
else
if(p==4){x1=g*1000+s*100+b*10+q;printf(“µ¹ÐòÊýΪ%d\n:”,x1);}
else
if(p==3){x2=g*100+s*10+b;printf(“µ¹ÐòÊýΪ%d\n:”,x2);}
else
if(p==2){x3=g*10+s;printf(“µ¹ÐòÊýΪ%d\n:”,x3);}
else
if(p==1){x4=g;printf(“µ¹ÐòÊýΪ%d\n:”,x4);}
getch();
}
题目4:
#include<stdio.h>
#include<stdlib.h>
main()
{
inta[8],i,b,j,swap;
printf(“ÇëÊäÈëÊý¾Ý£º\n”);
for(i=0;i<8;i++)scanf(“%d”,&a[i]);
for(i=0;i<7;i++)
{
swap=0;
for(j=0;j<8-i-1;j++)
{
if(a[j]>a[j+1])
{
swap=1;
b=a[j];
a[j]=a[j+1];
a[j+1]=b;
}
}
if(!swap)break;
}
for(i=0;i<8;i++)printf(“%d”,a[i]);
printf(“\n”);
getch();
}