原创 編寫一個函數reverse_string(char * string)(遞歸實現)

#include <stdio.h> void reverse_string(char * string) { int count = 0; char *p = string; char temp; while(*p != '\0

原创 4.22c++練練手

/*#include <iostream> using namespace std; class TDate { public: void SetDate(int y, int m, int d); int IsLeapYear

原创 4.3結構體

//通過指向結構體變量的指針變量輸出結構體變量中成員的信息 /*#include <stdio.h> #include <string.h> int main() { struct Student { long num; ch

原创 4_14練練手

//從鍵盤輸入10個學生的有關數據,然後把它們轉存到磁盤文件上去 /*#include <stdio.h> #define SIZE 10 struct Student_type { char name[10]; int num;

原创 用c語言多文件編寫1000人的通訊錄

實現一個通訊錄: 通訊錄可以用來存儲1000個人的信息,每個人的信息包括: 姓名,性別,年齡,電話,住址 提供方法: 1:                 添加聯繫人信息 2:                 刪除指定聯繫人信息 3:  

原创 用遞歸實現n的k次方

#include <stdio.h> int num(int n,int k) { static int count = 0; //必須用靜態變量來定義count,count每次調用不會被釋放 int sum = 1; if(

原创 用指針處理鏈表

//用指針處理鏈表 //建立一個簡單的鏈表,它由3個學生數據的結點組成,要求輸出各結點中的數據 /*#include <stdio.h> struct Student { int num; float score; struct S

原创 函數遞歸1

//用遞歸函數編寫厄密多項式 #include <stdio.h> int hermite(int n,int x) { int p; if(n <= 0) return 1; else if(n == 1 ) return

原创 選擇法

/*#include <stdio.h> #include <string.h> int main() { void sort( char *name[], int n ); //函數聲明 void print( char *

原创 4.10練練手

/*#include <stdio.h> #include <stdlib.h> #define LEN sizeof(struct Student) struct Student { long num; float score;

原创 寫一個遞歸函數DigitSum(n),輸入一個非負整數,返回組成它的數字之和,例如,調用DigitSum(1729),則應該返回1+7+2+9,它的和是19

#include <stdio.h> int digitsum(int x) { int i; if(x == 0) return 0; //遞歸結束條件 else { i = x % 10; x = x / 10;

原创 字符串追加

  實現char * my_strcat(char * dest,char *src)函數. 返回: dest字符串的地址。 功能:將src指向的字符串追加到dest指向字符串的後面。 例如:char dest[10] = “ande

原创 將字符串數字轉換爲數字

 編寫一個函數,將一個數字字符串轉換成這個字符串對應的數字(包括正浮點數、負浮點數) 例如:“12.34“  返回12.34 #include <stdio.h> #include <math.h> int main() { dou

原创 4.2結構體

/*#include <stdio.h> int main() { struct Student //聲明結構體類型 { long int num; char name[20]; char sex; ch

原创 3.31函數和指針

//指向數組元素的指針變量 //有一個3*4的二維數組,要求用指向元素的指針變量輸出二維數組個元素的值 /*#include <stdio.h> int main() { int a[3][4] = {{1,2,3,4},{5,6,7,