国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

尚硅谷C語言零基礎(chǔ)快速入門教程

2023-08-02 17:16 作者:writer  | 我要投稿

#include <stdio.h>

#include <stdlib.h>

#include <string.h>


//1.解決一個(gè)問題,目前沒有數(shù)據(jù)庫,應(yīng)該使用數(shù)結(jié)構(gòu)體賴保存數(shù)據(jù),才能達(dá)到效果

//2.

typedef struct Income{

double money;

char* state;

char* king;

double sum;

struct Income *next;

}Income;


Income* init(){ //初始化

Income* income = (Income*)malloc(sizeof(Income));

income -> money = 0.0;

income -> state = "";

income -> king = "";

income -> sum = 0.0;

income -> next = NULL;

return income;

}



void Income_init(Income* income,double data,char string[]){ //收入

//創(chuàng)建一個(gè)登錄收入結(jié)構(gòu)體需要多大的空間

double k = 0.0;

Income* node = (Income*)malloc(sizeof(Income));

node -> money = data;??//賦值

node -> state = string;?//賦值(地址)

node -> king = "收入";

k = income -> sum;

k += data;

node -> sum = k;

income -> sum = k;

node -> next = income -> next;

income -> next = node;

}


void expend_init(Income* income,double data,char string[]){ //支出

//創(chuàng)建一個(gè)登錄收入結(jié)構(gòu)體需要多大的空間

double k = 0.0;

Income* node = (Income*)malloc(sizeof(Income));

node -> money = data;??//賦值

node -> state = string;?//賦值

node -> king = "支出";

k = income -> sum;

k -= data;

node -> sum = k;

income -> sum = k;

node -> next = income -> next;

income -> next = node;

}



void forprint(Income* income){//明細(xì)

income = income -> next;

printf("————————當(dāng)前收支明細(xì)記錄————————\n");

printf("收支\t\t收支金額\t說明\t賬號金額\n");

while(income){

printf("%s\t\t%.2f\t\t%s\t\t%.2f\n",income -> king,income -> money,income -> state,income -> sum);

income = income -> next;

}

printf("\n");

}




void main(){

int tmp = 0;

double kl = 0; //金額

char name[30];

char turn = ' ';

Income* income = init();

while(1){

printf("————————家庭收支記賬軟件————————\n");

printf("\t\t1 收到明細(xì)\n");

printf("\t\t2 登錄收入\n");

printf("\t\t3 登錄支出\n");

printf("\t\t4 退??出\n");


printf("請選擇(1-4):");

scanf("%d",&tmp);

if(tmp == 2){//添加金額

printf("本次收入金額:");

scanf("%lf",&kl);

printf("本次收入說明:");

scanf("%s",name);

Income_init(income,kl,name);

}else if(tmp == 1){ //顯示明細(xì)

forprint(income);

}else if(tmp == 4){ //退出

getchar();

printf("\n確認(rèn)是否退出(Y/N):");

scanf("%c",&turn);

if(turn == 'Y' || turn == 'y'){

break;

}else if(turn == 'N' || turn == 'n'){

continue;

}else{

printf("請輸入有效值?。。n");

}

}else if(tmp == 3){//支出

printf("本次支出金額:");

scanf("%lf",&kl);

printf("本次支出說明:");

scanf("%s",name);

expend_init(income,kl,name);

}

}


getchar();


getchar();

}






尚硅谷C語言零基礎(chǔ)快速入門教程的評論 (共 條)

分享到微博請遵守國家法律
阿鲁科尔沁旗| 砀山县| 桃园县| 土默特右旗| 内江市| 南宁市| 潮州市| 澳门| 金昌市| 大邑县| 贵阳市| 平南县| 深泽县| 边坝县| 德阳市| 鄂尔多斯市| 兰西县| 峡江县| 杭锦旗| 望谟县| 江陵县| 叶城县| 卢湾区| 郯城县| 米林县| 福鼎市| 安仁县| 玉田县| 海门市| 白水县| 无棣县| 邵东县| 罗江县| 邹平县| 友谊县| 茌平县| 乐都县| 湟中县| 涞源县| 织金县| 绵竹市|