473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help me pleaseeee

Hello...
How can i related( link) one struct to another??
For another words, what i need itīs save information about every customer
movs in struct movs...( like historic data)
I used one txt file to store data info of the system...

#include <stdio.h>
#include <string.h>

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
}p1;

typedef struct customer cust;

struct movs
{
int contamov;
int a,m,y;
float montante;
}t1;

FILE *fp,*ft;


Feb 12 '07 #1
4 1281

"Maria Mela" <h4***@netvisao.ptwrote in message
Hello...
How can i related( link) one struct to another??
For another words, what i need itīs save information about every customer
movs in struct movs...( like historic data)
I used one txt file to store data info of the system...

#include <stdio.h>
#include <string.h>

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
}p1;

typedef struct customer cust;

struct movs
{
int contamov;
int a,m,y;
float montante;
}t1;

FILE *fp,*ft;
struct movs
{
int contamov;
int a,m,y;
float montante;
};

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
struct movs moves[256]; /* the customer's moves, up to 256 */
int Nmoves; /* the number of moves he has made */
};

struct customer customer_list[10000]; /* Let's hope you have lots of
customers */

The struct customer can have extra fields you don't read in from the text
file. If for some reason you don't want to do this, then you'll have to
create a wrapper structure called "custwithmoves" or similar to hold both a
customer and several moves.
Feb 12 '07 #2
Thks for your help...
I like your ideia... but how can implement this...
what are the best way to implement "custwithmoves" struct ?
"Malcolm McLean" <re*******@btinternet.comescreveu na mensagem
news:MY******************************@bt.com...
>
"Maria Mela" <h4***@netvisao.ptwrote in message
>Hello...
How can i related( link) one struct to another??
For another words, what i need itīs save information about every customer
movs in struct movs...( like historic data)
I used one txt file to store data info of the system...

#include <stdio.h>
#include <string.h>

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
}p1;

typedef struct customer cust;

struct movs
{
int contamov;
int a,m,y;
float montante;
}t1;

FILE *fp,*ft;
struct movs
{
int contamov;
int a,m,y;
float montante;
};

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
struct movs moves[256]; /* the customer's moves, up to 256 */
int Nmoves; /* the number of moves he has made */
};

struct customer customer_list[10000]; /* Let's hope you have lots of
customers */

The struct customer can have extra fields you don't read in from the text
file. If for some reason you don't want to do this, then you'll have to
create a wrapper structure called "custwithmoves" or similar to hold both
a customer and several moves.


Feb 12 '07 #3
Maria Mela wrote:
Thks for your help...
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>
Feb 12 '07 #4

"Maria Mela" <h4***@netvisao.ptwrote in message
Thks for your help...
I like your ideia... but how can implement this...
what are the best way to implement "custwithmoves" struct ?
"Malcolm McLean" <re*******@btinternet.comescreveu na mensagem
news:MY******************************@bt.com...
>>
"Maria Mela" <h4***@netvisao.ptwrote in message
>>Hello...
How can i related( link) one struct to another??
For another words, what i need itīs save information about every
customer movs in struct movs...( like historic data)
I used one txt file to store data info of the system...

#include <stdio.h>
#include <string.h>

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
}p1;

typedef struct customer cust;

struct movs
{
int contamov;
int a,m,y;
float montante;
}t1;

FILE *fp,*ft;
struct movs
{
int contamov;
int a,m,y;
float montante;
};

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
struct movs moves[256]; /* the customer's moves, up to 256 */
int Nmoves; /* the number of moves he has made */
};

struct customer customer_list[10000]; /* Let's hope you have lots of
customers */

The struct customer can have extra fields you don't read in from the text
file. If for some reason you don't want to do this, then you'll have to
create a wrapper structure called "custwithmoves" or similar to hold both
a customer and several moves.

C allows you to declare the shape of a structure and create an instance of
it in one go, and this is often taught in beginners' books.
In fact beginning exercises are about the only place where it is a good idea
to do this. Almost always in production code you will see the declaration
of the structure and the declaration of variables of that type separated
out.

struct movs
{
int contamov;
int a,m,y;
float montante;
};

struct customer
{
int dd,mm,yy,contador;
int d,m,y ,contamov;
char cus_name[255];
double cus_bal;
};

Structures can contain other structures very easily.

struct cust_with_moves
{
struct customer cust; /* the curomer data */
struct movs moves[256]; /* moves customer has made */
int Nmoves; /* number of moves (up to 256) */
};

Now declare your variable here

struct cust_with_moves customers[10000];

I don't know the logic of your program. You might want other buffers as
well, for instance one for customers who don't and can't have any moves, or
a temporary one to load in data from a file.
Feb 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
12
by: J. Hall | last post by:
Guys, Got this query... --------------------------- SELECT TOP 5 Tbl_admin_hotels.HotelName, (SELECT COUNT(Tbl_marketing_history.HotelID) FROM Tbl_marketing_history WHERE...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
3
by: marsandys | last post by:
Hello, I have this code below, which I am trying to have it send HTML formatted mail with embedded images. I can get this to send the mail, but it spits out a bunch of junk . I know this should...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
0
by: Giulia2686 | last post by:
hi i've a problem, when i try to dowload a jar file, containing postgre sql and also my sql, the pc give me an error message: Failed to load Main-Class manifest attirbute from C:\Document...
8
by: aruna | last post by:
to write a c program to find the roots of the equation using bisection method that too using array or pointers
3
by: outofmymind | last post by:
Hi, i've been practicing again......my exam is tomorrow :( and this is another practice question that my instructor told us to practice on, its not that easy, it was from a past final exam paper,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.