C语言中function(void)与function()的区别 看下面代码的编译结果void foo1(){}void foo2(void){}main(){ foo1(1); foo2(1); }编译:1.c: In&……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3241浏览 1747个赞
C语言找出大于一个数的最小回文数#include <stdio.h>#include <stdlib.h>#include <string.h>/***********************************************************************************……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2027浏览 860个赞
C语言按层次遍历二叉树算法#define MaxSize 1000typedef char ElemType; typedef struct node { ElemType data; struct node *lchild; struct node *rchild;} BTNode;//创建二叉树void CreateBTNode(……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2793浏览 2172个赞
汉诺塔:汉诺塔(又称河内塔)问题是源于印度一个古老传说的益智玩具。大梵天创造世界的时候做了三根金刚石柱子,在一根柱子上从下往上按照大小顺序摞着64片黄金圆盘。大梵天命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一次只能移动一个圆盘。#include<stdio.h>#in……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2307浏览 1368个赞
Linux环境下C语言实现贪吃蛇游戏[liul@test snake]$ more snake.c #include <stdio.h>#include <stdlib.h>#include <curses.h>#include <signal.h>#include <sys/time.h……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2582浏览 2208个赞
java二叉树查找、遍历、添加与删除package com.structures.tree;import java.util.ArrayList;import java.util.NoSuchElementException;import java.util.Stack;/* * Binary Search Tree */public ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2471浏览 1981个赞
C语言分割字符串strtok函数int argc = 0; char** argv = (char **) malloc(30 * sizeof(char *)); char *token = NULL; const char* delim = ","; const char* str = "My……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1466浏览 257个赞
C语言基础:格式化浮点数输出#include <stdio.h>int main () { float value = 1.23456; printf ("%8.1f\n", value); printf ("%8.3f\n", value); printf ("……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2490浏览 778个赞
C语言基础:for循环里矢量2个循环因子变量#include <stdio.h>int main() { int i, j; for (i = 0, j = 100; i <= 100; i++, j++) printf("i = %d j = %d\n", i, j);return 1……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3386浏览 788个赞
C语言二叉树遍历代码来自于郝斌老师的数据结构#include<stdio.h>#include<malloc.h>struct BTNode{char data;struct BTNode * pLchild;struct BTNode * pRchild;};void PreTraverseBTree(stru……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2996浏览 303个赞
C语言基础:for循环语句使用范例演示#include <stdio.h>int main () { int counter; for (counter = -100; counter <= 100; counter += 5) printf("%d ", counter); prin……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2590浏览 678个赞
C语言基础:for从大到小循环语句范例#include <stdio.h>int main () { int counter; for (counter = 5; counter >= 1; counter--) printf("%d ", counter); printf("……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1712浏览 2317个赞
C语言基础:for循环演示代码,字符循环和浮点数循环#include <stdio.h>int main () { char letter; float percent; for (letter = 'A'; letter <= 'Z'; letter++) pu……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2709浏览 469个赞
C语言基础:格式化输出带符号的数字#include <stdio.h>int main () { int int_value = 5; printf("Left justifed with sign %-+3d\n", int_value);return 1; } ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2506浏览 1309个赞
C语言基础:goto语句用法演示#include <stdio.h>int main() { int count = 1; label: printf("%d ", count++); if (count <= 100) goto label;retu……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3318浏览 260个赞
C语言基础:一个无限循环程序(死循环,不要运行)#include <stdio.h>int main () { int i; int result = 0; int value = 1; for (i = 0; i < 100; i++) { printf("%d "……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3317浏览 2446个赞
C语言基础:格式化整数输出#include <stdio.h>int main () { int value = 5; printf ("%1d\n", value); printf ("%2d\n", value); printf ("%3d\n", ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2816浏览 2499个赞
C语言基础:while语句使用范例#include <stdio.h>int main() { int counter = 1; // Initialize the control variable while (counter <= 100) // Test the control variable ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2262浏览 1990个赞
C语言基础:向左向右对其输出数字#include <stdio.h>int main () { int int_value = 5; float flt_value = 3.33; printf("Right justified %5d value\n", int_value); printf……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2801浏览 2855个赞
C语言基础:简单的数学运算#include <stdio.h>int main () { int seconds_in_an_hour; float average; seconds_in_an_hour = 60 * 60; average = (5 + 10 + 15 + 20) / 4; pr……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1390浏览 1243个赞
C语言基础:求模和取余演示#include <stdio.h>int main () { int remainder; int result; result = 10 / 3; remainder = 10 % 3; printf("10 Divided by 3 is %d Remainder ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2130浏览 789个赞
C语言基础:输出100以内的奇数和偶数#include <stdio.h>int main() { int counter; printf("\nEven values\n"); for (counter = 1; counter <= 100; counter++) { ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2530浏览 2129个赞
1. RSA说明RSA公钥加密算法是1977年由Ron Rivest、Adi Shamirh和LenAdleman在(美国麻省理工学院)开发的。RSA取名来自开发他们三者的名字。RSA算法基于一个十分简单的数论事实:将两个大素数相乘十分容易,但那时想要对其乘积进行因式分解却极其困难,因此可以将乘积公开作为加密密钥。2. RSA算法实现RSA算法是一种非对称密……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2494浏览 690个赞
C语言基础:将整数格式化成其它进制输出,如8进制,16进制#include <stdio.h>int main () { int value = 255; printf("The decimal value %d in octal is %o\n", value, value); p……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1979浏览 2638个赞
C语言基础:自增自减符号位置的区别,– a和a–的区别演示#include <stdio.h>int main () { int value = 1; printf("Using postfix %d\n", value--); printf("Valu……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1571浏览 746个赞
C语言基础:break语句使用范例代码#include <stdio.h>int main() { int counter; for (counter = 1; counter <= 100; counter++) { if (counter == 50) break; ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3258浏览 1396个赞
C语言基础:结构体及指针使用范例#include <stdio.h>#include <alloc.h>int main(void) { int i; struct ListEntry { int number; struct ListEntry *next; } start, *no……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2813浏览 2275个赞
C语言基础:常量的使用#include <stdio.h>#define ARRAY_SIZE 5int main(void) { int values[ARRAY_SIZE] = {80, 70, 90, 85, 80}; int i; for (i = 0; i < ARRAY_SIZE; i++) ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2085浏览 2278个赞
C语言数组:数组初始化代码演示#include <stdio.h>int main(void) { int values[5] = {80, 70, 90, 85, 80}; int i; for (i = 0; i < 5; i++) printf("values[%d] %d\n"……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1900浏览 1247个赞
《C++ Primer》中说:在C++中没有多维数组,只有元素师数组的数组。如:要想创建一个二维整数数组,首先要创建一个一维动态数组,它由int *类型的指针构成。int*就是这个一维int指针数组的类型。// String.cpp : Defines the entry point for the console application.//#……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2441浏览 802个赞
C语言基础:输出变量的内存地址#include <stdio.h>int main(void) { int count = 1; float salary = 40000.0; long distance = 1234567L; printf("Address of count is %x\n"……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3243浏览 104个赞
C语言基础:输出数组的内存地址#include <stdio.h>int main(void) { int count[10]; float salaries[5]; long distances[10]; printf("Address of the array count is %x\n"……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1468浏览 2302个赞
C语言基础:获取数组的长度#include <stdio.h>int main(void) { int scores[100]; float salaries[100]; char string[100]; printf("Bytes used to hold int scores[100] is %d……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2256浏览 354个赞
C语言基础:两个获取数组地址的方法#include <stdio.h>int main(void) { int count[10]; float salaries[5]; long distances[10]; printf("Address of the array count is %x &……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3315浏览 945个赞
C语言基础:数组作为函数参数调用代码演示#include <stdio.h>void show_array(int values[], int number_of_elements) { int i; for (i = 0; i < number_of_elements; i++) printf("%……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2097浏览 941个赞
C语言基础:数组作为函数参数传递演示代码#include <stdio.h>void show_array(int values[], int number_of_elements) { int i; printf("About to display %d values\n", number_of_ele……继续阅读 » 水墨上仙 5年前 (2021-03-22) 3202浏览 661个赞
C语言基础:二分查找法演示代码#include <stdio.h>int binary_search(int array[], int value, int size) { int found = 0; int high = size, low = 0, mid; mid = (high + low) / 2; ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2403浏览 2622个赞
C语言基础:修改结构体数据#include <stdio.h>struct Shape { int type; int color; float radius; float area; float perimeter;};void change_structure(struct Shape *shape) { ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1986浏览 882个赞
反转单向链表分为递归和非递归两种方式。递归的实现方式比较简单,而非递归实现效率较高,在面试时应注意边界条件。 这道题在面试时被要求现场作答的概率还是很大的,比较tricky的地方就是要在当前条件下保存好next of next的指针,如果一时想不起来程序怎么写,可以先自己画个图看看。// ReverseList.cpp : Defines the en……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1447浏览 2855个赞
C语言递归实现全排列来源:http://blog.csdn.net/creazyapple/article/details/7932432#include <stdio.h>int Swap(char *a,char *b){ char c; c = *a; *a = *b; *b = c;}/* ……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2702浏览 1892个赞
大家都知道,只有一个数时不用排序, 1.插入排序, 从第二个数开始,先将第二个数做一个副本放在一旁(变量中)。2.第二个数同前一个数比较,小于则用前一个数覆盖第二个数, 然后将副本放在前一个数前面3.再将第三个数做一个副本取出,第三个数同前一个数比较,小于则用前一个数覆盖第三个数(此时第二个数位置空闲), 然后用副本同前一个数的前一个数比较,如果小于,则用前……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1727浏览 1851个赞
C语言解决8皇后问题#include<iostream>using std::cout;using std::endl;#define my_abs(x) ((x)>=0?(x):(-(x)))const int n=8;void output(int a[],int n){static int count=1;cou……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2748浏览 1783个赞
C语言基础:数组元素访问 #include <stdio.h>int main(void) { int scores[5] = {80, 70, 90, 85, 80}; printf("Array Values\n"); printf("scores[0] %d\n", sco……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2343浏览 1011个赞
C语言数组:二位数组使用演示#include <stdio.h>void show_2d_array(int array[][10], int rows) { int i, j; for (i = 0; i < rows; i++) for (j = 0; j < 10; j++) pri……继续阅读 » 水墨上仙 5年前 (2021-03-22) 2368浏览 1716个赞
C语言基础:结构体初始化#include <stdio.h>int main(void) { struct Shape { int type; int color; float radius; float area; float perimeter; } circle = {0, 1,……继续阅读 » 水墨上仙 5年前 (2021-03-22) 1801浏览 933个赞