电子信息工程学系实验报告
课程名称:高级语言程序设计(C) 实验项目名称:Simple Programming 实验时间: 20##-03-01班级:计海111 姓名 jayden吴贵城 学号:110704137
实验目的:
The purpose of this experiment is to help students to know:
1. What’s a C program?
2. What’s the C programming environment and how to get familiar with the software environment
3. How to write a simple program according to the requirements and get the right output of the program.
实验环境:
Operating System: Window XP
Programming Software: Turbo C
实验内容及过程:
In the experiment, 3 problems need to be solved and they are:
1 The key program is: #include "stdio.h"
#include "conio.h"
main()
{
float h,s;
scanf("%f",&h);
s=(h-32)/1.8;
printf("s=%.2f\n",s);
getch();
}
2….(Title of the problem)
In this program, the main tools used are:
}
The key program is: #include "stdio.h"
#include "conio.h"
main()
{
float r,pi,s;
scanf("%f",&r);
pi=3.14;
s=pi*r*r;
printf("%f",s);
getch();
}
3….(Title of the problem)
The key program is: #include "stdio.h"
#include "conio.h"
main()
{
printf("2*1=\n");
printf("2*2=\n");
printf("2*3=\n");
getch();
实验结果及分析:
The output of the program 1 is :
In this program, the problem I met are:
The output of the program 2 is:
In this program, the problem I met are:
The output of the program 3 is :
In this program, the problem I met are:
实验心得:I can do the last one,it is so difficult.
附 录:
第二篇:实验一(实验报告示例)(2)
电子信息工程学系实验报告
课程名称:高级语言程序设计(C) 实验项目名称:Use of decision making( if else & operators)实验时间:2012/3/18 班级:计海111
姓名:袁俊杰 学号:110704119
实 验 目 的:
The purpose of this experiment is to help students to know:
The purpose of this experiment is to help students to know:
The use of if- else & decision making in programming
实 验 环 境:
Operating System: Window XP
Programming Software: turbo C/Win tc
实 验 内 容 及 过 程:
1. Write a program to determine the given year is a leap year or not use the logical operators && and ||
The key programm is :
#include <stdio.h>
#include <conio.h>
main()
{
int year;
printf("Please input year\n");
scanf("%d",&year);
if ( year%4==0&&year%100!=0|| year%400==0)
printf(" it is a leap year\n");
else
printf(" it is not a leap year\n");
getch();
}
2. A library charges a fine for every book returned late for first 5 days the fine is 50 fen( jiao ) for 6-10 days fine is 1 rmb and above 10 days fine is 5 rmb. If return the book after 30 days your membership will be cancelled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message.
The key programm is :
#include <stdio.h>
#include <conio.h>
main()
{
int day,fine;
printf("Please input day\n");
scanf("%d",&day);
if( day>30)
fine=" your membership will be cancelled";
else if(day>10)
fine="5 rmb";
else if (day>5)
fine="1 rmb ";
else if(day>0)
fine=("50 fen");
else
fine=("0");
printf("%s\n",fine);
getch();
}
实 验 结 果 及 分 析:
The output of the program 1
In this program, the problem 1 met are:Don’t use “&&. ||”skillfully
The output of the program 2
In this program, the problem 2 met are:why don’t use “else if”at the last
实 验 心 得:
Use C must be careful,
Reading the book usually