五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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ǔ)快速入門教程的評論 (共 條)

分享到微博請遵守國家法律
陆良县| 平乡县| 兰溪市| 丽水市| 新邵县| 蒙山县| 绥阳县| 马关县| 繁峙县| 深圳市| 宜章县| 四川省| 孝感市| 陆丰市| 博客| 新民市| 扶沟县| 伊吾县| 体育| 子长县| 竹山县| 大英县| 鄱阳县| 阿荣旗| 浪卡子县| 雅江县| 三门县| 蓬溪县| 青田县| 麻城市| 襄汾县| 扎囊县| 大冶市| 出国| 吉首市| 迁安市| 台前县| 凤山市| 通道| 黑河市| 揭阳市|