
C 程序题
wang yang
用心走在C的道路上—— Romantic_c
展开
-
二维数组查找&一维数组转换
1。 输入一个整数数组,实现一个函数,来调整该数组中数字的顺序使得数组中所有的奇数位于数组的前半部分,所有偶数位于数组的后半部分。 这里写代码片2。 有一个二维数组,数组的每行从左到右是递增的,每列从上到下是递增的.在这样的数组中查找一个数字是否存在。 时间复杂度小于O(N); 这里写代码片原创 2018-03-07 21:08:14 · 588 阅读 · 0 评论 -
函数:判断是不是闰年;判断是不是素数
函数:判断是不是闰年;判断是不是素(质)数原创 2017-10-16 17:51:18 · 732 阅读 · 0 评论 -
实现一个函数,打印出乘法口诀
猜数字游戏: http://blog.youkuaiyun.com/romantic_c/article/details/78135924 三子棋: http://blog.youkuaiyun.com/romantic_c/article/details/78311056 关机程序: http://blog.youkuaiyun.com/romantic_c/article/details/78093507原创 2017-10-26 23:24:37 · 853 阅读 · 0 评论 -
实现一个函数排序各种类型的数据
一个函数排序各种类型的数据。(冒泡排序)原创 2018-03-12 00:04:35 · 1741 阅读 · 0 评论 -
模拟实现简单计算器
1。#include <stdio.h>#include <assert.h>#pragma warning (disable:4996)int my_add(int a,int b){ return a + b;}int my_sub(int a,int b){ return a - b;}int my_mul(int a,int b){ return a原创 2018-03-10 21:19:58 · 3431 阅读 · 0 评论 -
喝汽水,1瓶汽水1元,2个空瓶可以换一瓶汽水,给20元,可以多少汽水。编程实现。
此算法最后手里定剩一个空瓶,,,,没有设计到:最后剩一个空瓶,找老板借得一空瓶,换取水喝完后,把手里的空瓶还给老板。原创 2018-03-10 00:45:40 · 597 阅读 · 0 评论 -
一个数组中只有两个数字是出现一次,其他所有数字都出现了两次。 找出这两个数字,编程实现。
一个数组中只有两个数字是出现一次,其他所有数字都出现了两次。找出这两个数字,编程实现。原创 2018-03-10 00:19:24 · 499 阅读 · 0 评论 -
可变参数(题)
可变参数。题原创 2018-03-09 23:02:00 · 730 阅读 · 0 评论 -
位&翻转(2)
1。实现一个函数,可以左旋字符串中的k个字符#include #include #include #pragma warning(disable:4996)void Inverse(char *x,char *y){ while(x<y) { *x^=*y; *y^=*x; *x^=*y; x++;原创 2018-03-07 21:05:37 · 516 阅读 · 0 评论 -
位&反转
1。编写函数: 这个函数的返回值value的二进制位模式从左到右翻转后的值。 例:在32位机器上输入25这个值包含下列各位: 00000000000000000000000000011001 翻转后: 2550136832 #include <stdio.h>int reverse_bit( int val){ int data=0; int i=0; int原创 2018-03-07 13:07:59 · 651 阅读 · 0 评论 -
递归
1。 递归和非递归分别实现求第n个斐波那契数。 #include <stdio.h>#include <assert.h>#pragma warning(disable:4996) int Fib_1(int size){ assert(size); if(size<=2) { return 1; } return Fib_1(siz原创 2018-03-08 14:12:59 · 443 阅读 · 0 评论 -
两个整数的交换方法
1,指针交换两个数#include "stdio.h"void swap (int*a,int*b){ int t; t=*a; *a=*b; *b=t;}int main(){ int x,y; scanf ("%d%d",&x,&y); printf ("x=%d,y=%d\n",x,y); swap (&x,&y);原创 2017-09-26 23:01:14 · 1319 阅读 · 0 评论