Help on (*Ptr)

P

Progressus

Hi Everyone,

I want to make a system that simulates the movements of a debit card.
This system must keep the numbers of card, name of added users, as well
as the date of the emission of each card and the dates and type of the
ten last movements. The system must allow to create, to erase, to
change and to list the cards. I have Already developed some code, but
now I´ve a problem in this situation...

void Insert_card (PtrCl *lista)
{
work´s well
}
void Change_card (PtrCl *lista)
{
work´s well
}
void Remove_card (PtrCl *lista)
{
work´s well
}
void Ver_cards(PtrCl *lista)
{
I cant associate more than one record data of "void trans_cards(PtrCl
*lista)" per card
}
void trans_cards(PtrCl *lista)
{
}
Can anyone help in this regard.

Thanks in advance!!!
 
J

jacob navia

Dear customer

We are ready to fulfill your request, and we thank you for the
confidence you give us by placing your order.

Please buy products for US$ 200 at our website. When your VISA
card payments are accepted we will gladly send you the requested
program.

Yours sincerely

J.K. OB

Customer support.

P.S.
Our website address:
www.DoMyHomework.com
 
I

Ico

Progressus said:
Hi Everyone,

I want to make a system that simulates the movements of a debit card.
This system must keep the numbers of card, name of added users, as well
as the date of the emission of each card and the dates and type of the
ten last movements. The system must allow to create, to erase, to
change and to list the cards. I have Already developed some code, but
now I?ve a problem in this situation...

void Insert_card (PtrCl *lista)
{
work?s well
}
void Change_card (PtrCl *lista)
{
work?s well
}
void Remove_card (PtrCl *lista)
{
work?s well
}
void Ver_cards(PtrCl *lista)
{
I cant associate more than one record data of "void trans_cards(PtrCl
*lista)" per card

Ah, I see. The error is at line 42, check your code.
 
D

David T. Ashley

Progressus said:
Hi Everyone,

void Ver_cards(PtrCl *lista)
{
I cant associate more than one record data of "void trans_cards(PtrCl
*lista)" per card
}

There isn't quite enough information in your post to understand what you
need.

If this is just a linked list one-to-many issue ...

In 'C', if you want to build a linked structure where the number of children
(or items linked to) is known in advance, you can just define the fields
statically in a structure. You might find such an arrangement in a linked
list or classic binary tree.

However, if a node has a variable number of children, then you typically
use:

a)A dynamically-allocated node, containing the node data, and containing a
pointer to ...

b)A dynamically-allocated array of pointers, each of which points to a child
in the form of (a).

(b) gets a bit complex because you need to keep track of how many pointers
are there and realloc() as needed to grow the list.

If this isn't your question, you need to post more information.
 
P

Progressus

Here´s my code... please comment...
Thks

void list_cards (PtrCl *lista)
{
PtrCl aux=(*lista);
if (aux!=NULL)
{
while (aux!=NULL)
{
clrscr();
printf ("\nCard Movs : ");
printf ("\nType of Mov -> ");
switch(aux->trans_tipo)
case CRG: printf("CRG");
break;
case DBT: printf("DBT");
break;
case TRF: printf("TRF");
printf ("\nDate of Mov ->%d /%d
/%d",aux->diatrans,aux->mestrans,aux->anotrans);
getch ();
aux=aux->next;
}
}
else
Erro ("Error!");
}
void mov_card (PtrCl *lista)
{
PtrCl aux=NULL, inicio=NULL;
int cod=0,cont;
if ((*lista) != NULL)
{
printf ("\nCard Number -> ");
scanf ("%d", &cod);
aux=(*lista);
while (aux!=NULL && aux->num_card!=cod)
aux=aux->next;
if (aux!=NULL)
{
clrscr();
printf ("Data Mov\n\n");
printf ("\n Date of Mov (dd/mm/aa):");
printf ("\n Day");
scanf("%d",&aux->diatrans);
printf ("\n Month");
scanf("%d",&aux->mestrans);
printf ("\n Year");
scanf("%d",&aux->anotrans);
printf ("\n Type of Mov:\n 1 - CRG\n 2 - DBT\n 3 - TRF\n");
scanf("%d",&aux->trans_tipo);
printf ("Data completed.");
getch ();
}
else
Erro ("Error!!!");
}
else
Erro ("\nError !!!");
}
 
D

David T. Ashley

Here´s my code... please comment...
Thks

You need to pose a specific question. What are you wanting to do that you
can't?
 
R

Richard Heathfield

David T. Ashley said:
Here´s my code... please comment...
Thks

You need to pose a specific question.

Why? This is a discussion group, not a helpdesk.
 
C

CBFalconer

Progressus said:
Here´s my code... please comment...

void list_cards (PtrCl *lista)
{
PtrCl aux=(*lista);
if (aux!=NULL)
{
while (aux!=NULL)
{
clrscr();
.... snip ...

It doesn't have a chance. It lacks a main, any declarations, any
#includes, it uses non-existant routines such as clrscr(), and it
is totally illegible lacking proper indentation and formatting. It
is also totally unconnected to anything, due to the lack of
suitable quoting. Your mark is F-.

--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
 
J

jacob navia

Richard Heathfield a écrit :
David T. Ashley said:




Why? This is a discussion group, not a helpdesk.

I agree with mr heathfield.

enough is enough!

Why should we do the homework of all the students in the world?

I have a standard message (that I posted in this thread)
for this kind of recurring post. Please let's stop
aiding lazy students!

jacob
 
S

santosh

jacob said:
Richard Heathfield a écrit :
I agree with mr heathfield.

enough is enough!

Why should we do the homework of all the students in the world?

Nothing in the contents of the OP's posts to this thread indicate that
it is an homework problem. He could be someone trying to learn C
privately.

I agree though that the code posted for review is illegible enough to
deter most potential responders.
I have a standard message (that I posted in this thread)
for this kind of recurring post. Please let's stop
aiding lazy students!

Yes I've seen it. It's not nice to include a link to a non-existing
website, letting a possibly naive OP waste his time and bandwidth. A
simple line to the effect that requests for code are not encouraged or
responded to would be sufficient response.
 
R

Richard Heathfield

Progressus said:
Here´s my code... please comment...

foo.c:17: warning: string constant runs past end of line
foo.c:1: parse error before `*'
foo.c:2: warning: function declaration isn't a prototype
foo.c: In function `list_cards':
foo.c:3: `PtrCl' undeclared (first use in this function)
foo.c:3: (Each undeclared identifier is reported only once
foo.c:3: for each function it appears in.)
foo.c:3: parse error before `aux'
foo.c:4: `aux' undeclared (first use in this function)
foo.c:4: `NULL' undeclared (first use in this function)
foo.c:8: warning: implicit declaration of function `clrscr'
foo.c:9: warning: implicit declaration of function `printf'
foo.c:12: `CRG' undeclared (first use in this function)
foo.c:12: warning: unreachable code at beginning of switch statement
foo.c:14: `DBT' undeclared (first use in this function)
foo.c:16: `TRF' undeclared (first use in this function)
foo.c:17: warning: ANSI C forbids newline in string constant
foo.c:19: warning: implicit declaration of function `getch'
foo.c:24: warning: implicit declaration of function `Erro'
foo.c: At top level:
foo.c:26: parse error before `*'
foo.c:27: warning: function declaration isn't a prototype
foo.c: In function `mov_card':
foo.c:28: `PtrCl' undeclared (first use in this function)
foo.c:28: parse error before `aux'
foo.c:30: `lista' undeclared (first use in this function)
foo.c:30: `NULL' undeclared (first use in this function)
foo.c:33: warning: implicit declaration of function `scanf'
foo.c:34: `aux' undeclared (first use in this function)
foo.c:29: warning: unused variable `cont'
make: *** [foo.o] Error 1

No problem.
 
D

David T. Ashley

Yes I've seen it. It's not nice to include a link to a non-existing
website, letting a possibly naive OP waste his time and bandwidth. A
simple line to the effect that requests for code are not encouraged or
responded to would be sufficient response.

Believe it or not, www.domyhomework.com is a bona fide site.
 
M

matevzb

Nothing in the contents of the OP's posts to this thread indicate that
it is an homework problem. He could be someone trying to learn C
privately.
Erm... doesn't the following resemble homework instructions? =)
"This system must keep the numbers of card, name of added users, as
well
as the date of the emission of each card and the dates and type of
the
ten last movements. The system must allow to create, to erase, to
change and to list the cards."
Of course, there is a possibility that (s)he wrote the specs, it just
doesn't seem very probable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top