广东工业大学 C语言课程设计报告


一、 设计任务目的与要求

1、  进一步掌握和利用C语言进行程设计的能力;
2、  进一步理解和运用结构化程设计的思想和方法;
3、  初步掌握开发一个小型实用系统的基本方法;
4、  学会调试一个较长程序的基本方法;
5、  学会利用流程图或N-S图表示算法;
6、  掌握书写程设计开发文档的能力(书写课程设计报告);


二、 设计内容  

1、 总体设计

l 说明包含几大功能模块

l 画出系统功能模块结构图和系统流程图

l 数据结构设计及用法说明

 

2、 详细设计

l 函数名字:

l 函数功能:

l 数据结构设计描述,参数说明

实现过程:写算法或解决思路,贴(NS图或流程图)


学生奖学金管理系统流程图如下

 

使用到的结构体变量

 

struct Student

{

char Sid[10];

char Sclass[20];

char Sname[20];

int Math;

int English;

int Physic;

int Sum;

int rank;

struct Student *next;

};


简介:以上的结构体为学生奖学金管理系统的核心部分,是贯穿整个系统的灵魂。存储和读取都是以结构体的形式进行的,每个结构体包含着丰富的信息。


項目源代码:

# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# define SIZE sizeof(struct Student)

struct Student
{	
	char Sid[10];
	char Sclass[20];
	char Sname[20];
	int Math;
	int English;
	int Physic;
	int Sum;
	int rank;
	struct Student *next;
}; 

void ShowMenu()
{
	printf("\n***********************************************************\n");
	printf("\twelcome to Stugent bonus management system\n\n");
	printf("\t1-------------- Record\n");                    
	printf("\t2-------------- Show all record\n");                  
	printf("\t3-------------- Find\n");
	printf("\t4-------------- Statistics\n");
	printf("\t5-------------- Delete\n");
	printf("\t6-------------- Add\n");
	printf("\t7-------------- Sort\n");
	printf("\t8-------------- Save File\n");
	printf("\t9-------------- Copy File\n");
	printf("\t10------------- Exit\n\n");                   
	printf("***********************************************************\n");
}

//从键盘中输入的数据创建链表
struct Student * in_stuNode()
{
	struct Student * head, * p1, * p2;
	int n = 0;
	p1 = p2 = (struct Student *)malloc(SIZE);

	head = NULL;
	
	scanf("%s",  p1->Sid);
	while(p1->Sid[0] != '@')
	{
		scanf("%s%s%d%d%d", p1->Sclass, p1->Sname, &p1->Math, &p1->English, &p1->Physic);
		p1->Sum = 0; p1->rank = 0;
		n++;
		if(n == 1)
		{
			head = p1;
		}else
		{
			p2->next = p1;
		}
		p2 = p1;

		p1 = (struct Student *)malloc(SIZE);
		scanf("%s",  p1->Sid);
	}
	p2->next = NULL;        
	return head;
}

//从链表中的数据 写入文件
void Record(struct Student *head)
{
	FILE *fp;
	struct Student  *p1;
	p1 = head;

	if((fp = fopen("D:\\Course\\student.txt", "w")) == NULL)
	{
		printf("cannot open this file\n");
		return;
	}

	while(p1 != NULL)
	{
		fprintf(fp, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);
/*		if(fwrite(p1, SIZE, 1, fp) != 1)
			{
				printf("file write error\n");
			}
*/
		p1 = p1->next; 

	}

	if(p1 == NULL){
	printf("Record ok!\n");
	}

	free(p1);
	free(head);
	fclose(fp);

}

//从文件中读取的数据创建链表
struct Student * File_stuNode(){

	FILE *fp;
	int n = 0;
	struct Student *head, *p2, *p1;

	if((fp = fopen("D:\\Course\\student.txt", "r")) == NULL)
	{
		printf("cannot open this file\n");
		return NULL;
	}

	head = NULL;

	p2 = p1 = (struct Student *)malloc(SIZE);
	fscanf(fp, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d", p1->Sid, p1->Sclass, p1->Sname, &p1->Math, &p1->English, &p1->Physic, &p1->Sum, &p1->rank);
//	fread(p1, SIZE, 1, fp);
	while(!feof(fp))
	{
		
		n++;
		if(n == 1)
		{
			head = p2;
		}else
		{
			p2->next = p1; 
		}
		p2 = p1;
		p1 = (struct Student *)malloc(SIZE);
	    fscanf(fp, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d", p1->Sid, p1->Sclass, p1->Sname, &p1->Math, &p1->English, &p1->Physic, &p1->Sum, &p1->rank);
//		fread(p1, SIZE, 1, fp);
	}

	p2->next = NULL;
	fclose(fp);

	return head;
}

void Show_stuNode()
{
	printf("---------------------------STUDENT------------------------------------\n");
	printf("|no		|class	|name	|sc1	|sc2	|sc3    |sum	|order|\n");
	printf("----------------------------------------------------------------------\n");
	struct Student *p, *head;
	head = File_stuNode();     调用 File_stuNode()

	p = head;
	while(p != NULL)
	{
		printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p->Sid, p->Sclass, p->Sname, p->Math, p->English, p->Physic, p->Sum, p->rank);
		
		p = p->next; 
	}

}

void ShowMenu3()
{
	printf("\t****************************************\n");

	printf("\t1----------按名次查询某学生的个人成绩\n");

	printf("\t2----------按班级查询班级前3名学生的个人成绩\n");

	printf("\t3----------按成绩段查询某学生的个人成绩\n");

	printf("\t4----------exit\n");

	printf("\t****************************************\n");

}

void SortRank()
{
	struct Student *p1, *head, *p2;
	int i;
	head = File_stuNode();

	p1 = head;

	while(p1 != NULL)
	{
		i = 1;
		p2 = head;
		while(p2 != NULL)
		{
			if(p1->Sum < p2->Sum)
			{
				i++;
			}
			p2 = p2->next;
		}
		p1->rank = i;
		p1 = p1->next;

	}

	Record(head);
}

void SearchByRank()
{
	struct Student *p1, *head;
	int number;
	head = File_stuNode();
	p1 = head;

	if(p1->rank == 0)
	{
		printf("你还没有排名呢?请返回主菜单执行操作7\n");
		return;
	}
	printf("请输入要查询的名次:");

	scanf("%d", &number);

	while(p1 != NULL)
	{
		if(p1->rank == number)
		{
			printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);
		}
		p1 = p1->next;
	}

	free(p1);
	free(head);

}

void SearchByClass()
{

	int i = 1;
	char Class[10] = {0};
	struct Student *p1, *head, *p2;

	printf("请输入要查询的班级:如201501 \n");
	scanf("%s", Class);

	head = File_stuNode();
	p1 = head;

	while(p1 != NULL)
	{
		if(strcmp(Class, p1->Sclass) == 0)
		{
			i = 1;
			p2 = head;
			while(p2 != NULL)
			{
				if(strcmp(Class, p2->Sclass) == 0)
				{
					if(p1->Sum < p2->Sum)
						{
							i++;
						}
				}
				p2 = p2->next;
			}

			if(i <= 3)
			{
				printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);	
			}
			else if(i > 3)
			{
				break;
			}
		}
		p1 = p1->next;
	}

	free(p1);
	free(head);

}

void SearchByScore()
{
	int scope1, scope2;
	int i = 0;
	struct Student *p1, *head;
	char course[10] = {0};

	printf("请输入要查询的分数段:如 70 - 80 \n");
	scanf("%d-%d", &scope1, &scope2);
	if(scope1 >= scope2)
	{
		printf("scope2 must be bigger than scope1!\n");
		return;
	}

	printf("请输入要查询的科目:(Math、English、Physic) \n");

	scanf("%s", course); 
	if(!(strcmp(course, "Math") == 0 || strcmp(course, "English") == 0 || strcmp(course, "Physic") == 0))
	{
		printf("no found the course\n");
		return;
	}

	head = File_stuNode();

	p1 = head;

	while(p1 != NULL)
	{
		if(strcmp(course, "Math")==0)
		{
			if(p1->Math >= scope1 && p1->Math <= scope2)
			{
				printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);		
				i++;
			}
		}else if(strcmp(course, "English")==0)
		{
			if(p1->English >= scope1 && p1->English <= scope2)
			{
				printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);		
				i++;
			}
		}else if(strcmp(course, "Physic")==0)
		{
			if(p1->Physic >= scope1 && p1->Physic <= scope2)
			{
				printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);		
				i++;
			}
		}
		p1 = p1->next;
	}
		if(i == 0)
		{
			printf("no the student adopt to adition\n");
		}

}

void Search()
{
	int op;
	do
	{
		ShowMenu3();
		printf("\tplease choose the option:: ");
		scanf("%d", &op);

		switch(op)
		{
			case 1: SearchByRank(); break;

			case 2: SearchByClass(); break;

			case 3: SearchByScore(); break;

			case 4: break;

			default : printf("input error!\n");
		} 
	}while(op != 4);

}
void ShowMenu4()
{
	printf("\t****************************************\n");

	printf("\t1-------------- 总计\n");

	printf("\t2-------------- 分班统计\n");

	printf("\t3----------exit\n");

	printf("\t****************************************\n");

}
void StatByStu()
{	
	struct Student *head, *p1;

	head = File_stuNode();

	p1 = head;
	while(p1 != NULL)
	{
		p1->Sum = p1->Math + p1->English + p1->Physic;

		p1 = p1->next;
	}

	Record(head);
	
}

void StatByClass()
{
	char Class[10][10] = {0};
	int ClassSum[10] = {0};
	FILE *fp;
	struct Student *head, *p1;
	int i = 0;  //  记录class总数
	int j;
	int tag = 1;

	head = File_stuNode();
	p1 = head;

	while(p1 != NULL)
	{
		tag = 1;
		for(j = 0; j < i; j++)
		{
			if(strcmp(Class[j] , p1->Sclass) == 0)
			{
				tag = 0; break;
			}
		}
		if(tag == 1)
		{
			strcpy(Class[i++], p1->Sclass);	
		}
		p1 = p1->next;
	}

	p1 = head;
	while(p1 != NULL)
	{
		for(j = 0; j < i; j++)
		{
			if(strcmp(p1->Sclass, Class[j]) == 0)
			{
				ClassSum[j] += p1->Sum;
			}
		}
		p1 = p1->next;
	}



	if((fp = fopen("D:\\Course\\student1.txt", "w+")) == NULL)
	{
		printf("cannot open this file\n");
		return;
	}
	
	for(j = 0; j < i; j++)
	{
		printf("%s %d\n", Class[j], ClassSum[j]);
	}
}
void Statistics()
{
	int op;
	do
	{
		ShowMenu4();
		printf("\tplease choose the option:: ");
		scanf("%d", &op);

		switch(op)
		{
			case 1: StatByStu(); break;

			case 2: StatByClass(); break;

			case 3: break;

			default : printf("input error!\n");
		} 
	}while(op != 3);

}
struct Student * RankSort(struct Student * head)
{
	int i;
	struct Student *p1, *p2;

	p1 = head;
	while(p1 != NULL)
	{
		i = 1;
		p2 = head;
		while(p2 != NULL)
		{
			if(p1->Sum < p2->Sum)
			{
				i++;
			}
			p2 = p2->next;
		}
		p1->rank = i;
		p1 = p1->next;

	}

	return head;
}

/* 
	对链表 按 rank 实现从小到大排序, 并返回链表的头指针。
*/
struct Student * SortByRank(struct Student *head)
{
	struct Student *p1, *p2, *p3;

	struct Student t;

    for(p1 = head; p1 != NULL; p1 = p1->next)
    {
		p3 = p1;
		for(p2 = p1->next; p2 != NULL; p2 = p2->next)
		{
			if(p3->Sum < p2->Sum)
			{
				p3 = p2;   

			}
		}
		if(p3 != p1)
		{

			t.English = p1->English;
			t.Math = p1->Math;
			t.Physic = p1->Physic;
			t.Sum = p1->Sum;
			strcpy(t.Sclass, p1->Sclass);
			strcpy(t.Sid, p1->Sid);
			strcpy(t.Sname, p1->Sname);

			p1->English = p3->English;
			p1->Math = p3->Math;
			p1->Physic = p3->Physic;
			p1->Sum = p3->Sum;
			strcpy(p1->Sclass, p3->Sclass);
			strcpy(p1->Sid, p3->Sid);
			strcpy(p1->Sname, p3->Sname);

			p3->English = t.English;
			p3->Math = t.Math;
			p3->Physic = t.Physic;
			p3->Sum = t.Sum;
			strcpy(p3->Sclass, t.Sclass);
			strcpy(p3->Sid, t.Sid);
			strcpy(p3->Sname, t.Sname);
	
		}
    }
	RankSort(head);   
    return head;
}


/* 
	对链表 按 Sid 实现从小到大排序, 并返回链表的头指针。
*/
struct Student * SortBySid(struct Student *head)
{
	struct Student *p1, *p2, *p3;

	struct Student t;

    for(p1 = head; p1 != NULL; p1 = p1->next)
    {
		p3 = p1;
		for(p2 = p1->next; p2 != NULL; p2 = p2->next)
		{
			if(strcmp(p3->Sid, p2->Sid) > 0)
			{
				p3 = p2;
			}
		}
		if(p3 != p1)
		{
			t.English = p1->English;
			t.Math = p1->Math;
			t.Physic = p1->Physic;
			strcpy(t.Sclass, p1->Sclass);
			strcpy(t.Sid, p1->Sid);
			strcpy(t.Sname, p1->Sname);

			p1->English = p3->English;
			p1->Math = p3->Math;
			p1->Physic = p3->Physic;
			strcpy(p1->Sclass, p3->Sclass);
			strcpy(p1->Sid, p3->Sid);
			strcpy(p1->Sname, p3->Sname);

			p3->English = t.English;
			p3->Math = t.Math;
			p3->Physic = t.Physic;
			strcpy(p3->Sclass, t.Sclass);
			strcpy(p3->Sid, t.Sid);
			strcpy(p3->Sname, t.Sname);
	
		}
    }

	// 统计总分;
	p1 = head;
	while(p1 != NULL)
	{
		p1->Sum = p1->Math + p1->English + p1->Physic;

		p1 = p1->next;
	}
	
	head = RankSort(head);   //  排名;
    return head;
}

void ShowSortBy(int i)
{
	struct Student *head, *p1;
	SortRank(); 
	head = File_stuNode();

	p1 = head;

	if(i == 1)
	{
		p1 = SortByRank(p1);	
	}
	else if(i == 2)
	{
		p1 = SortBySid(p1);
	}
	while(p1 != NULL)
	{

		printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);		
		p1 = p1->next;
	}
}

void ShowSort()
{
	int op;
	do
	{
		printf("\t****************************************\n");

		printf("\t1----------sort by the rank for all student\n");

		printf("\t2----------sort by the Sid for all student\n");

		printf("\t3----------Exit!\n");

		printf("\t****************************************\n");

		printf("\tplease choose the option:: ");
		scanf("%d", &op);

		switch(op)
		{
			case 1: ShowSortBy(op); break;

			case 2: ShowSortBy(op); break;

			case 3: break;

			default : printf("input error!\n");
		} 
	}while(op != 3);

}
void Delete()
{
	struct Student *p1, *head, *p2;
	char stuid[10] = {0};
	int tag = 0;

	head = File_stuNode();

	printf("please input the deleted stuSid:\n");
	scanf("%s", stuid);

	p1 = head;
	p2 = NULL;
	while(p1 != NULL)
	{
		if(strcmp(p1->Sid, stuid) == 0)
		{
			if(p2 == NULL)
			{
				head = p1->next; // 删除是 head 结点
				tag = 1;
				break;
			}else{

				if(p1->next == NULL)
				{
					p2->next = NULL; // 删除是 尾节点 
				    tag = 1;
					break;
				}
				p2->next = p1->next;
				tag = 1;
				break;
			}
		}
		p2 = p1;
		p1 = p1->next;
	}
	if(tag == 0)
	{
		printf("no found the student!\n");
	}else{
		Record(head);
	}

}

void  Add()
{
	struct Student * head1, *head2, *p1, *head;

	head1 = File_stuNode();
	head2 = in_stuNode();

	p1 = head1;
	if(p1 != NULL)
	{
		while(p1->next != NULL)
		{
			p1 = p1->next;
		}
		head = head1;
		p1->next = head2;
		
	}
	else
	{
		head = head2;	
	}
	if(head == NULL){
		printf("Y");}
	Record(head);

}

void CopyFile(){
	FILE *fp, *fp1;
	char filename[30] = {0};
	char filename1[30] = {0};
	struct  Student *p1, stu;

	printf("please input the fileName\n");
	scanf("%s", filename);

	getchar();
	printf("please input the fileName path\n");
	scanf("%s", filename1);
	getchar();

	if((fp = fopen(filename, "r")) == NULL)
	{
		printf("open file error");
		return;
	}

	if((fp1 = fopen(filename1, "w")) == NULL)
	{
		printf("open file error");
		return;
	}

	p1 = &stu;

	while(!feof(fp))
	{
		fscanf(fp, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d", p1->Sid, p1->Sclass, p1->Sname, &p1->Math, &p1->English, &p1->Physic, &p1->Sum, &p1->rank);
		fprintf(fp1, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);
	}

	fclose(fp);
	fclose(fp1);
}

void SaveFile() 
{
	FILE *fp;
	char filename[30] = {0};
	struct  Student *head, *p1;

	scanf("%s", filename);
	getchar();
	if((fp = fopen(filename, "w")) == NULL)
	{
		printf("open file error");
		return;
	}

	head = File_stuNode();
	
	p1 = head;
	while(p1 != NULL)
	{
		fprintf(fp, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n", p1->Sid, p1->Sclass, p1->Sname, p1->Math, p1->English, p1->Physic, p1->Sum, p1->rank);

		p1 = p1->next;
	}

	free(head);
	free(p1);
	fclose(fp);
}

int main()
{
	int option;
	
	do
	{
		ShowMenu();
		printf("\tplease choose the option: ");
		scanf("%d", &option);
		getchar();

		switch(option)
		{
			case 1: Record(in_stuNode()); break;

			case 2: Show_stuNode(); break;

			case 3: Search(); break;

			case 4: Statistics(); break;

			case 5: Delete(); break;

			case 6: Add(); break;

			case 7: ShowSort(); break;

			case 8: SaveFile();break;

			case 9: CopyFile();break;

			case 10: break;

			default : printf("input error!");

		}
	}while(option != 10);

	return 0;
}



目录 摘 要..............................................................1 1设计内容、任务及具体要求.........................................2 1.1设计内容.....................................................2 1.2设计任务及具体要求...........................................2 2概要设计.........................................................3 2.1该系统的功能简介.............................................3 2.2 总体程序框图.................................................3 2.3各个模块之间的主要关系........................................4 3系统功能模块的具体设计............................................5 3.1各个模块的程序流程图及运行界面................................5 3.2对关键代码加以分析说明.......................................15 4程序调试分析.....................................................23 5程序使用说明.....................................................24 6总结.............................................................25 致谢...........................................................26 参考文献...........................................................27 附:源程序..........................................................28 摘 要 工资管理系统是针对企业的工资管理业务进行计算机处理而开发的应用软件。该系统由系统维护、输入、查询、修改、输出、统计等子模块组成,功能基本涵盖普通企业的工资管理业务范围。企业应用本系统后,可以有效的提高工资管理水平。本文从需求分析、开发平台选择、系统模块建立、数据库设计、功能模块编程实现及软件测试等方面阐述了本应用系统的设计过程。为便于说明,文中绘制了程序结构框图、数据流程图和部分界面图。最后附有主要的源程序代码清单。 关键词:工资管理 系统维护 数据汇总 管理系统 软件开发
CSU 大一上 C语言实验报告 (1)教材第2章编程题第2题:编写计算球体体积的程序。 说明:本题声明适当变量,用户键入数据,运算并输出结果,较简单。 (2)教材第2章编程题第8题:编写程序计算第一、第二、第三月还贷后剩余贷款金额。 说明:本题要求用户输入总额、利率、每月还贷净额,输出每月剩余,对输入输出、类型定义考查。 (3)教材第3章编程题第2题:编写程序实现对用户输入的产品信息进行格式化。 说明:本题考查格式化输入输出、转义字符的运用。 (4)教材第4章编程题第4题:编写程序实现将输入的整数按八进制输出。 说明:本题重在考查简单的运算符和表达式运用。 (5)用户输入一个三位数,输出各位数字之和。 说明:本题重在考查如何从一个整数中取出每一个数字。 (6)教材第5章编程题第5题:编写程序计算用户输入所得额的税金。 说明:本题考查简单的选择结构。 (7)教材第5章编程题第11题:编写程序实现将用户输入的两位数转化为英文。 说明:本题考查switch语句的应用。 (8)教材第6章编程题第8题:编写程序显示单月日历,用户指定这个月的天数和该月起始日是星期几。 说明:本题考查循环结构和选择结构的综合应用,判断是否一个星期最后一天,换行符。 (9)教材第6章编程题第11题:编程序实现利用无穷级数法估计e的值。 说明:本题考查根据公式设计循环结构并实现。 (10)因子之和等于其本身的数称为完数,如28的因子为1、2、4、7、14,而28=1+2+4+7+14,因此28为完数。编程序找出2~5000中的完数。 说明:本题利用变量i在2~5000中变化,判断其是否是完数。 (11)教材第7章编程题第12题:编程计算从左至右求值的表达式的值。 说明:本题考查对运算符和操作数的判断。 (12)教材第7章编程题第14题:编程序用牛顿计算法计算浮点数平方根。 说明:本题考查对循环结构的掌握,对表达式的合理运用,对基本类型的理解。 (13)教材第8章编程题第14题:编写程序颠倒句子中单词的顺序。 说明:本题考查对字符数组的处理,对一些循环选择结构的理解。 (14)教材第8章编程题第15题:编写程序实现凯撒密码加密。 说明:本题考查对字符数组的掌握,对字符处理的理解。 (15)编程序实现将用户输入的数字字符串转化为整数输出。 说明:本题考察对字符、整数关系的掌握与理解,对循环结构的熟练运用。 (16)教材第9章编程题第1题:编写选择排序的函数,并递归调用。 说明:本题利用函数简化程序、使得结构更清晰、熟练掌握。 (17)教材第9章编程题第7题:编写计算xn的函数。 说明:本题考查函数定义、调用,并初步考察递归运用。 (18)教材第10章编程题第6题:编写程序实现逆波兰运算。 说明:本题考查对程序每部分的理解、掌握,外部、内部变量,主函数,小函数的编写与应用。初步了解栈的一些实现函数。 (19)编程序找出2~5000中满足条件的数x:x是素数且x的每位数字是素数、每位数字之和是素数,如23、223、2333等。 说明:本题考查函数方法与循环选择结构的综合运用。 (20)教材第11章编程题第3题:用指针变量编写简化一个分数的函数。 说明:本题用来解决函数无法传回传递的实际参数,指针变量。 (21)教材第12章编程题第2题:编写函数读入用户输入的一条消息,检测是否是回文,分别用数组、指针来解决。 说明:本题可以体会到数组与指针的特点,利用指针的便利。 (22)利用指针编写程序,实现从键盘键入字符串,将此字符串从m个字符开始的n个字符复制成另一个字符串。 说明:本题用指针指向字符串,进行跟踪和复制操作。 (23)教材第13章编程题第5题:编写程序实现对输入命令行参数求和。 说明:本题加深对命令行参数的理解、考查知识的综合应用。 (24)教材第16章编程题第5题:用结构变量解决搜索离用户输入时间最近的航班信息,并输出。 说明:本题考查结构与数组的结合运用,有助于理解结构。首先,定义一个存储起飞、到达时间的结构,再定义一个该类型的数组,循环搜索即可。 (25)教材第17章编程题第5题:用指针数组存储键入的字符串,对数组排序。 说明:本题应用动态分配内存、数组排序,考查综合能力。
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mrchesian

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值