全局变量余额计算 [英] Global var in Balance calculation

查看:78
本文介绍了全局变量余额计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......

有人可以帮我解决这个问题吗?

i我的申请中有这个代码:

卡片创建
/ * * /

typedef struct card

{

等等

}卡;

typedef卡* PtrCrt;


/ *用于创建转换* /

typedef struct trans

{

等等

} Trans;

typedef Trans * PtrTrans;


我需要计算每张卡的余额以及如何将此验证

放在一个函数中?!

Hello everyone...
Anybody can help me on this question, please?
i′ve this code in my application:

/*for Card creation*/
typedef struct card
{
etc,etc
} Card;
typedef Card *PtrCrt;

/*For trans creation*/
typedef struct trans
{
etc,etc
} Trans;
typedef Trans *PtrTrans;

I need to calculate the Balance of every card and how put this verification
in one function?!

推荐答案



" Maria Mela" < h4 *** @ netvisao.ptwrote in message

news:ne ******************** @ newsfront4.netvisao.pt。 ..

"Maria Mela" <h4***@netvisao.ptwrote in message
news:ne********************@newsfront4.netvisao.pt ...

大家好......

有人可以帮我解决这个问题吗?

i'在我的应用程序中使用此代码:


/ *用于创建卡* /

typedef struct card

{

等等

}卡;

typedef卡* PtrCrt;


/ *用于创建转换* /

typedef struct trans

{

等等

} Trans;

typedef Trans * PtrTrans;


我需要计算每张卡的余额以及如何将这个

验证放在一个函数中?!
Hello everyone...
Anybody can help me on this question, please?
i′ve this code in my application:

/*for Card creation*/
typedef struct card
{
etc,etc
} Card;
typedef Card *PtrCrt;

/*For trans creation*/
typedef struct trans
{
etc,etc
} Trans;
typedef Trans *PtrTrans;

I need to calculate the Balance of every card and how put this
verification in one function?!



int balance(const Card * c)

{

int result;

/ *计算* /

返回结果;

}


int main(无效)

{

卡c = {/ *等* /};

printf(" balance =%d \ n",余额(& c) );

返回0;

}


如需更具体的建议,请询问更具体的问题。


-Mike

int balance(const Card *c)
{
int result;
/* calculate */
return result;
}

int main(void)
{
Card c = { /* etc. */ };
printf("balance = %d\n", balance(&c));
return 0;
}

For more specific advice, ask more specific questions.

-Mike


Maria Mela写道:
Maria Mela wrote:

大家好......

有人可以帮我解决这个问题吗?

i我的应用程序中的代码:


/ *用于创建卡片* /

typedef struct card

{

等等

}卡;

typedef卡* PtrCrt;


/ *用于创建转换* /

typedef struct trans

{

等等

} Trans;

typedef Trans * PtrTrans;


我是ed计算每张卡的余额以及如何将此验证

放在一个函数中?!

Hello everyone...
Anybody can help me on this question, please?
i′ve this code in my application:

/*for Card creation*/
typedef struct card
{
etc,etc
} Card;
typedef Card *PtrCrt;

/*For trans creation*/
typedef struct trans
{
etc,etc
} Trans;
typedef Trans *PtrTrans;

I need to calculate the Balance of every card and how put this verification
in one function?!



请更具体。卡的余额是多少?你需要验证什么?b $ b需要验证?你是如何表示卡的聚合的?

作为一个数组?一个单链表?许多单链表?


PS

http://www.nls.net/mp/413/sea.ZIP

自扩展阵列。 (这是你的大学教授的代码

警告过你。):) :) :)

Please be more specific. What is the balance of a card? What do you
need to verify? How are you representing the aggregation of cards?
As an array? A singly-linked list? Many singly-linked lists?

P.S.

http://www.nls.net/mp/413/sea.ZIP

Self-expanding arrays. (This is the code your college professor
warned you about.) :) :) :)


求你帮忙......但是更具体地说,这是我的代码的一部分...


#include< stdio.h>

#include< stdlib.h> ;

#include< conio.h>

#include< alloc.h>

#include< string.h>


typedef enum观察

{

Item1 = 1,Item2,Item3,Item4,Item5


}观察;

typedef enum trans_type

{

CRG = 1,DBT,TRF


} Trans_type;


typedef enum utente

{

学生= 1,工程师,教授


} Utente;


typedef struct data

{

int day,month,year;


}数据;

typedef struct card

{

int num_card;

char name [255];

Utente utente;

数据数据;

浮动余额;

char morada [60];

struct card * next;


}卡;


typedef卡* PtrCrt;


typedef struct transaccions

{

int codigo;

char nome [60];

数据;

Trans_tipo trans_tipo;

float montante,crg;

Observacoes observacoes;

char local_treinos [60];

char nome_treinador [60];

struct trans * next;

PtrCrt p_cartao;


} Trans;


typedef Trans * PtrTrans ;

/ * ------------------------函数-------------- ---------- * /


void Insert_Card(PtrCrt * lista);

void Change_Card(PtrCrt * lista);

void Remove_Card(PtrCrt * lista);

void View_Cards(PtrCrt * lista);

void Delet_Cards(PtrCrt * lista);

int View_if_Cards(PtrCrt * lista,int cod,int ver);


void Insert_Trans(PtrTrans * lista);

void Remove_Trans(PtrTrans * lista);

void View_Trans(PtrTrans * lista);

void Delet_Trans(PtrTrans * lista);

int View_if_Trans(PtrTrans * lista,int cod,int ver);

void错误(char * msg);

PtrCrt Adress_Card(PtrCrt * lista,int cod);

PtrTrans Adress_Trans(PtrTrans * lista,int cod);


void View_Cards_Assoc(PtrCrt * lista);

void View_Card_Trans(PtrTrans * lista);

void Menu_Cards(void);

void Menu_Transaccions(void );


void Menu_Listall(void);

我需要计算所有新交易中每张卡的余额和

怎么把这个验证

放在一个函数中?!

最好为动作(transaccions)卡创建一个更多的strcut?

我'我很困惑......

Jeff Mullen < 41*@nls.netescreveu na mensagem

新闻:a3 ************************* @ ALLTEL.NET ...
Thks for your help... But to be more specific here′s one part of my code...

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <alloc.h>
#include <string.h>

typedef enum observations
{
Item1=1,Item2,Item3,Item4,Item5

}Observations;
typedef enum trans_type
{
CRG=1, DBT,TRF

}Trans_type;

typedef enum utente
{
Student=1, Functionary ,Professor

}Utente;

typedef struct data
{
int day, month, year;

}Data;
typedef struct card
{
int num_card;
char name[255];
Utente utente;
Data data;
float balance;
char morada[60];
struct card *next;

} Card;

typedef Card *PtrCrt;

typedef struct transaccions
{
int codigo;
char nome[60];
Data data;
Trans_tipo trans_tipo;
float montante,crg;
Observacoes observacoes;
char local_treinos[60];
char nome_treinador[60];
struct trans *next;
PtrCrt p_cartao;

} Trans;

typedef Trans *PtrTrans;
/*------------------------Functions------------------------*/

void Insert_Card (PtrCrt *lista);
void Change_Card (PtrCrt *lista);
void Remove_Card (PtrCrt *lista);
void View_Cards (PtrCrt *lista);
void Delet_Cards (PtrCrt *lista);
int View_if_Cards (PtrCrt *lista, int cod, int ver);

void Insert_Trans (PtrTrans *lista);
void Remove_Trans (PtrTrans *lista);
void View_Trans (PtrTrans *lista);
void Delet_Trans (PtrTrans *lista);
int View_if_Trans (PtrTrans *lista, int cod, int ver);
void Error (char *msg);
PtrCrt Adress_Card (PtrCrt *lista, int cod);
PtrTrans Adress_Trans (PtrTrans *lista, int cod);

void View_Cards_Assoc (PtrCrt *lista);
void View_Card_Trans (PtrTrans *lista);
void Menu_Cards (void);
void Menu_Transaccions (void);

void Menu_Listall (void);
I need to calculate the Balance of every card in all new transaccions and
how put this verification
in one function?!
It′s better create one more strcut for movements (transaccions) cards?
I′m confused...
"Jeff Mullen" <41*@nls.netescreveu na mensagem
news:a3*************************@ALLTEL.NET...

Maria Mela写道:
Maria Mela wrote:

>大家好......
有人可以帮我解决这个问题吗?
我的申请表中有这个代码:

/ *用于创建卡片* /
typedef struct card
{
等等
}卡;
typedef卡* PtrCrt;

/ *用于创建转换* /
typedef struct trans
{
等等
} Trans;
typedef Trans * PtrTrans;

我需要计算每张卡的余额以及如何将此
验证放入一个功能?!

>Hello everyone...
Anybody can help me on this question, please?
i′ve this code in my application:

/*for Card creation*/
typedef struct card
{
etc,etc
} Card;
typedef Card *PtrCrt;

/*For trans creation*/
typedef struct trans
{
etc,etc
} Trans;
typedef Trans *PtrTrans;

I need to calculate the Balance of every card and how put this
verification in one function?!



请更具体一点。卡的余额是多少?你需要验证什么?b $ b需要验证?你是如何表示卡的聚合的?

作为一个数组?一个单链表?许多单链表?


PS

http://www.nls.net/mp/413/sea.ZIP

自扩展阵列。 (这是你的大学教授的代码

警告过你。):) :) :)


Please be more specific. What is the balance of a card? What do you
need to verify? How are you representing the aggregation of cards?
As an array? A singly-linked list? Many singly-linked lists?

P.S.

http://www.nls.net/mp/413/sea.ZIP

Self-expanding arrays. (This is the code your college professor
warned you about.) :) :) :)



这篇关于全局变量余额计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆