C语言判断一个素数能被几个9整除 main(){ long int m9=9,sum=9;int zi,n1=1,c9=1;scanf("%d",&zi);while(n1!=0){ if(!(sum%zi))n1=0;else{m9=m9*10;sum=sum+m9;c9++;}}printf(&……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1817浏览 200个赞
C语言两个字符串连接程序#include "stdio.h"main(){char a[]="acegikm";char b[]="bdfhjlnpq";char c[80],*p;int i=0,j=0,k=0;while(a[i]!='\0'&&am……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2111浏览 2097个赞
某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的,加密规则如下:每位数字都加上5,然后用和除以10的余数代替该数字,再将第一位和第四位交换,第二位和第三位交换。main(){int a,i,aa[4],t;scanf("%d",&a);aa[0]=a%10;aa[1]=a%100/10;aa[2……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1507浏览 1384个赞
C语言归并排序算法演示代码#include <iostream> using namespace std; void merge(int*,int,int,int); void mergesort(int *a, int low,int high){ int pivot; if(low<……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1757浏览 2083个赞
解释如下:双斜杠之后是注释掉的.前面http:相当于一个goto的标签#include <stdio.h>int main(){ http://www.shello.name/ printf("haha!!\n"); return 0;}……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2023浏览 2921个赞
C语言中function(void)与function()的区别 看下面代码的编译结果void foo1(){}void foo2(void){}main(){ foo1(1); foo2(1); }编译:1.c: In&……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1357浏览 284个赞
C语言找出大于一个数的最小回文数#include <stdio.h>#include <stdlib.h>#include <string.h>/***********************************************************************************……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2070浏览 837个赞
C语言按层次遍历二叉树算法#define MaxSize 1000typedef char ElemType; typedef struct node { ElemType data; struct node *lchild; struct node *rchild;} BTNode;//创建二叉树void CreateBTNode(……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1926浏览 2422个赞
汉诺塔:汉诺塔(又称河内塔)问题是源于印度一个古老传说的益智玩具。大梵天创造世界的时候做了三根金刚石柱子,在一根柱子上从下往上按照大小顺序摞着64片黄金圆盘。大梵天命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一次只能移动一个圆盘。#include<stdio.h>#in……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2885浏览 1602个赞
Linux环境下C语言实现贪吃蛇游戏[liul@test snake]$ more snake.c #include <stdio.h>#include <stdlib.h>#include <curses.h>#include <signal.h>#include <sys/time.h……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2737浏览 1439个赞
java二叉树查找、遍历、添加与删除package com.structures.tree;import java.util.ArrayList;import java.util.NoSuchElementException;import java.util.Stack;/* * Binary Search Tree */public ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2815浏览 1634个赞
C语言分割字符串strtok函数int argc = 0; char** argv = (char **) malloc(30 * sizeof(char *)); char *token = NULL; const char* delim = ","; const char* str = "My……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1170浏览 1492个赞
C语言基础:格式化浮点数输出#include <stdio.h>int main () { float value = 1.23456; printf ("%8.1f\n", value); printf ("%8.3f\n", value); printf ("……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2486浏览 1980个赞
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……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2841浏览 521个赞
C语言二叉树遍历代码来自于郝斌老师的数据结构#include<stdio.h>#include<malloc.h>struct BTNode{char data;struct BTNode * pLchild;struct BTNode * pRchild;};void PreTraverseBTree(stru……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2951浏览 2618个赞
C语言基础:for循环语句使用范例演示#include <stdio.h>int main () { int counter; for (counter = -100; counter <= 100; counter += 5) printf("%d ", counter); prin……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2643浏览 972个赞
C语言基础:for从大到小循环语句范例#include <stdio.h>int main () { int counter; for (counter = 5; counter >= 1; counter--) printf("%d ", counter); printf("……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2908浏览 1181个赞
C语言基础:for循环演示代码,字符循环和浮点数循环#include <stdio.h>int main () { char letter; float percent; for (letter = 'A'; letter <= 'Z'; letter++) pu……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2805浏览 589个赞
C语言基础:格式化输出带符号的数字#include <stdio.h>int main () { int int_value = 5; printf("Left justifed with sign %-+3d\n", int_value);return 1; } ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2540浏览 2593个赞
C语言基础:goto语句用法演示#include <stdio.h>int main() { int count = 1; label: printf("%d ", count++); if (count <= 100) goto label;retu……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2094浏览 961个赞
C语言基础:一个无限循环程序(死循环,不要运行)#include <stdio.h>int main () { int i; int result = 0; int value = 1; for (i = 0; i < 100; i++) { printf("%d "……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2262浏览 458个赞
C语言基础:格式化整数输出#include <stdio.h>int main () { int value = 5; printf ("%1d\n", value); printf ("%2d\n", value); printf ("%3d\n", ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1722浏览 2918个赞
C语言基础:while语句使用范例#include <stdio.h>int main() { int counter = 1; // Initialize the control variable while (counter <= 100) // Test the control variable ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1407浏览 2139个赞
C语言基础:向左向右对其输出数字#include <stdio.h>int main () { int int_value = 5; float flt_value = 3.33; printf("Right justified %5d value\n", int_value); printf……继续阅读 » 水墨上仙 4年前 (2021-03-22) 3070浏览 1189个赞
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……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1618浏览 2766个赞
C语言基础:求模和取余演示#include <stdio.h>int main () { int remainder; int result; result = 10 / 3; remainder = 10 % 3; printf("10 Divided by 3 is %d Remainder ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2272浏览 161个赞
C语言基础:输出100以内的奇数和偶数#include <stdio.h>int main() { int counter; printf("\nEven values\n"); for (counter = 1; counter <= 100; counter++) { ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2556浏览 1082个赞
1. RSA说明RSA公钥加密算法是1977年由Ron Rivest、Adi Shamirh和LenAdleman在(美国麻省理工学院)开发的。RSA取名来自开发他们三者的名字。RSA算法基于一个十分简单的数论事实:将两个大素数相乘十分容易,但那时想要对其乘积进行因式分解却极其困难,因此可以将乘积公开作为加密密钥。2. RSA算法实现RSA算法是一种非对称密……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2196浏览 161个赞
C语言基础:将整数格式化成其它进制输出,如8进制,16进制#include <stdio.h>int main () { int value = 255; printf("The decimal value %d in octal is %o\n", value, value); p……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2329浏览 1493个赞
C语言基础:自增自减符号位置的区别,– a和a–的区别演示#include <stdio.h>int main () { int value = 1; printf("Using postfix %d\n", value--); printf("Valu……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1419浏览 856个赞
C语言基础:break语句使用范例代码#include <stdio.h>int main() { int counter; for (counter = 1; counter <= 100; counter++) { if (counter == 50) break; ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2855浏览 2160个赞
C语言基础:结构体及指针使用范例#include <stdio.h>#include <alloc.h>int main(void) { int i; struct ListEntry { int number; struct ListEntry *next; } start, *no……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2829浏览 247个赞
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++) ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2894浏览 2858个赞
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"……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2251浏览 282个赞
《C++ Primer》中说:在C++中没有多维数组,只有元素师数组的数组。如:要想创建一个二维整数数组,首先要创建一个一维动态数组,它由int *类型的指针构成。int*就是这个一维int指针数组的类型。// String.cpp : Defines the entry point for the console application.//#……继续阅读 » 水墨上仙 4年前 (2021-03-22) 3026浏览 2393个赞
C语言基础:输出变量的内存地址#include <stdio.h>int main(void) { int count = 1; float salary = 40000.0; long distance = 1234567L; printf("Address of count is %x\n"……继续阅读 » 水墨上仙 4年前 (2021-03-22) 3121浏览 2093个赞
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"……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2614浏览 765个赞
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……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1368浏览 358个赞
C语言基础:两个获取数组地址的方法#include <stdio.h>int main(void) { int count[10]; float salaries[5]; long distances[10]; printf("Address of the array count is %x &……继续阅读 » 水墨上仙 4年前 (2021-03-22) 3025浏览 883个赞
C语言基础:数组作为函数参数调用代码演示#include <stdio.h>void show_array(int values[], int number_of_elements) { int i; for (i = 0; i < number_of_elements; i++) printf("%……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1528浏览 971个赞
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……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2506浏览 462个赞
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; ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2298浏览 1024个赞
C语言基础:修改结构体数据#include <stdio.h>struct Shape { int type; int color; float radius; float area; float perimeter;};void change_structure(struct Shape *shape) { ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2389浏览 1220个赞
反转单向链表分为递归和非递归两种方式。递归的实现方式比较简单,而非递归实现效率较高,在面试时应注意边界条件。 这道题在面试时被要求现场作答的概率还是很大的,比较tricky的地方就是要在当前条件下保存好next of next的指针,如果一时想不起来程序怎么写,可以先自己画个图看看。// ReverseList.cpp : Defines the en……继续阅读 » 水墨上仙 4年前 (2021-03-22) 2795浏览 117个赞
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;}/* ……继续阅读 » 水墨上仙 4年前 (2021-03-22) 1890浏览 848个赞