原创 每日一編c-7

/*題目: 有n個數,使其前面各數順序向後移m個位置,最後m個數變成最前面的m個數 版本:v 1.0 */ #include <stdio.h> void *move(int *,int n,int m); main() { int

原创 每日一編C++

/* Copyright (c)2014, 天津大學通信工程專業學生 * All rightsreserved. * 文件名稱: my_test.cpp * 作 者: 王貝貝 * 完成日期:2014 年 4 月 5 日

原创 每日一編C-2

/*實現將輸入的字符串反序輸出*/ #include <stdio.h> #include <string.h> main() { char str[200],temp; int i,j,k; printf(" Enter

原创 每日一編C-1

/*判斷101-200之間有多少的素數,並輸出所有素數及其個數*/ #include <stdio.h> #include <math.h> int main() { int m,i,k,h,leap; h=0; leap=

原创 每日一編C-6

/*編寫一個程序,使得每行以一個單詞的形式打印其輸出*/ #include <stdio.h> #define IN 1 #define OUT 0 int main() { int c,state; state=IN; w

原创 每日一編C-8

來源:http://blog.csdn.net/yueyawanbian/article/details/23861229 #include <stdio.h> //遞歸實現階乘 long long int factorial(int

原创 每日一編c-5

題目要求:編寫一個將輸入複製到輸出的程序,並將其中連續的多個空格用一個空格代替 代碼: #include <stdio.h> int main() { int c,c_pre; c_pre=getchar(); putch

原创 關於使用sizeof()求數組的長度

看征服C指針,在p131關於sizeof()求數組長度這一知識點做了一個小測試,程序代碼如下: #include <stdio.h> void func( int str[]) { printf("the length of the

原创 每日一編C-4

本來是想模擬一個國際象棋棋盤的,結果輸出的是: 源碼如下: #include <stdio.h> int main () { int i,j; for ( i=0; i<8; i++) {for ( j=0; j

原创 每日一編C-3

昨天看了一個建立有三個結點的簡單鏈表,今天記錄下 #include <stdio.h> struct student { int num; char *name; int age; struct student *next

原创 關於指向數組的指針

首先來個小例子:#include <stdio.h> int main() { int array[3]={1,2,3}; int (*p_a

原创 實現可變長數組的數組-征服C指針

/*使用指針數組實現可變長數組(參考征服C指針)p116*/ #include <stdio.h> #include <stdlib.h> #inc

原创 多維數組做函數參數的表示方法

在上一篇,提到了關於數組的指針的概念,這篇文章將講述一個數組的指針的應用。 在一維數組作爲參數傳遞給函數時,有兩種方式:(假設爲int的數組) (1)void func (int array[ ] ); (2)void func ( in

原创 最大公約數和最小公倍數

/*輸入兩個正整數,求其最大公約數和最小公倍數*/ #include <stdio.h> int min( int a, int b); int max( int a, int b); main() { int m,n; pr

原创 C++ const變量

轉載:http://developer.51cto.com/art/201002/182348.htm 在C++編程語言中,還有很多比較高深的內容值得我們在學習和實踐中不斷的學習。在這篇文章中,我們將會爲大家詳細介紹有關C++ con