
C语言
六月心悸
一个好二好二的男孩子
展开
-
C语言-对输入n个字符串进行排序(无导入string.h)
#include #include "stdlib.h"#define N 256 //宏定义//比较两个字符串的大小int str_compare(const char* src,const char* dst){ int ret = 0; if (src == dst) { return 0; } if (dst == NULL) { return -1;原创 2015-06-01 10:57:25 · 2585 阅读 · 0 评论 -
C语言-动态分配内存对任意个字符串进行排序
//动态分配内存对输入的任意字符串排序#include#include#include#include//比较大小//int str_compare(const char* src,const char* dst)//{// int ret = 0;// if (src == dst)// {// return 0;// }// if (dst == NULL)//原创 2015-06-01 11:03:47 · 2441 阅读 · 0 评论 -
C语言-对输入的n个字符串进行排序
#include#include#include#define N 256 //宏定义int main(){ char strArray[N][256]; char *str[N]; char *temp; int i,n; printf("请输入字符串:\n"); for(i=0;i<N;i++) { gets(strArray[i]); if (st原创 2015-06-01 10:47:57 · 20160 阅读 · 6 评论 -
C语言-输入任意个字符串
来源网站:==== http://bbs.youkuaiyun.com/topics/391045349?page=1#post-399279449方法一://输入任意个字符串#include #include #include #define LINE 5int main(){ int i = 0, n = LINE; int l, len; char **str;原创 2015-06-01 10:59:05 · 7710 阅读 · 0 评论 -
C语言 对输入的一个字符串进行排序
#include #include #include void main() { char str[50]; int i,j,len; printf("请输入字符串:"); scanf("%s",str); len=strlen(str);//计算你输入的字符串的长度 if(len>50) { puts("输入的字符大于50!重新输入:"); s原创 2015-06-01 10:45:16 · 13306 阅读 · 1 评论 -
C语言-对一个结构体中的字段进行排序
这是帮别人做的一个题目,好久没有接触过C语言了,有点发怵,不过似乎找回点当时学C语言,做课程设计的感觉。题目:定义一个数组(学生结构体数组),里面包含学号、姓名、身份证和三科学生成绩,要求写一个函数,根据学生任何一个字段(如学号、姓名、身份证),进行排序。源码://// stu.cpp : Defines the entry point for the console applic原创 2015-07-12 12:39:05 · 8018 阅读 · 1 评论