c语言
itshia
这个作者很懒,什么都没留下…
展开
-
输出三角数
#include<stdio.h>int tri(int data);int main() { int count; for (count = 0; count <= 100; count++) { tri(count); } return 0;}int tri(int data) { int total = 0; for (i原创 2017-11-12 23:10:20 · 286 阅读 · 0 评论 -
飞机座位
#include<stdio.h>int main() { int a; int fSeat=0, eSeat=5; int fc[5] = { 0 }, ec[5] = { 0 }; int flag=1,count; int i; char choose; for (count = 0; count <= 10 && flag == 1;原创 2017-11-26 10:47:29 · 730 阅读 · 0 评论 -
肿瘤检测
//肿瘤检测#include<stdio.h>int main() { int zl[100][100]; int n; int c = 0, s = 0; int i = 0, j = 0; scanf("%d", &n); for (i = 0; i<n; i++) { for (j = 0; j<n; j++) {原创 2017-11-25 23:50:24 · 909 阅读 · 0 评论 -
浅谈C语言中如何取随机数
1. 基本函数在C语言中取随机数所需要的函数是:int rand(void);void srand (unsigned int n);rand()函数和srand()函数被声明在头文件stdlib.h中,所以要使用这两个函数必须包含该头文件:#include stdlib.h>2. 使用方法 rand()函数返回0到RAND_MAX之间的伪随机数(ps转载 2017-11-25 22:36:22 · 2109 阅读 · 0 评论 -
关于c的烫烫烫烫烫烫
为什么我们有时候在进行字符串处理的问题中,当我们输出字符串的值的时候,或者我们调试程序查看字符串变量的值的时候,会出现"烫"和"屯:等怪异的中文字符,其实这个问题的往往是由于要访问的地址的内容字符未被初始化,或者我们访问了非法内存。未初始化的变量会被系统赋初值为0xCC,超过了ASCII码0-127这个范围,因此这个"字符串"被系统当成了宽字符组成的字符串,即两个字节数据组成一个字符,而0xC转载 2017-11-22 21:54:01 · 2391 阅读 · 0 评论 -
修改冒泡排序法
Description: 修改课件中的冒泡排序法,对10个数进行排序。使之可以显示排序过程中的信息以及一共经过的比较次数,输出结果如下。Sample Input: 2 6 4 8 10 12 89 68 45 37Sample Output: After pass 0 : 2 4 6 8 10 12 68 45 37 89 After pass 1 : 2原创 2017-11-22 19:44:33 · 627 阅读 · 0 评论 -
c语言数组-消除重复
#include<stdio.h>#define SIZE 20void order(int number[]);int main() { int input[SIZE] = { 20,26,32,21,65,95,86,77,36,20,19,16,36,84,59,66,23,15,16,85 }; int mid, i = 0; order(input);原创 2017-11-22 00:06:31 · 1999 阅读 · 0 评论 -
数组例题
#include<stdio.h>#define RESPONSES_SIZE 40#define FREQUENCY_SIZE 11int main() { int frequency[FREQUENCY_SIZE] = { 0 }; int responses[RESPONSES_SIZE] = { 1,2,6,4,8,5,9,7,8,10,1,6,3,8,6,10,3,8,2原创 2017-11-20 23:41:40 · 288 阅读 · 0 评论 -
关于指针(1)
int main(){ int a = 5; int *p = &a; printf("%p\n", p);//correct printf("%p\n", &a);//correct printf("%p\n", a); printf("%p\n", *p); printf("*********\n"); printf("%d\n",原创 2017-11-29 21:18:42 · 187 阅读 · 0 评论 -
C语言--指向函数的指针
转帖自: http://wenku.baidu.com/view/7e566448cf84b9d528ea7a57.html1 定义和调用程序在编译后,每个函数都有一个首地址(也就是函数第一条指令的地址),这个地址称为函数的指针。可以定义指向函数的指针变量,使用指针变量间接调用函数。下面通过一个简单的例子来说明:float max(float x,float y){return x>y?x:y;转载 2017-12-06 09:23:42 · 349 阅读 · 0 评论