473,398 Members | 2,403 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,398 software developers and data experts.

Poblem with Structural array

9
Hey, I am trying to declare an array of 12 structs that will hold information from a file input.

I have my struct

Expand|Select|Wrap|Line Numbers
  1.  
  2. struct month
  3. {
  4.     float totalRain, highTemp, lowTemp, averageTemp;
  5. };
  6.  

and this is my array

Expand|Select|Wrap|Line Numbers
  1. struct month fullYear[12];
  2.  
These are my struct variables.

Expand|Select|Wrap|Line Numbers
  1. month jan, feb, mar, april, may, june, jul, aug, sept, oct, nov, dec;
  2.  

each of the struct variables will be placed in the array respectively, but I am unsure how to read the information from the file putting them in their rightfull place.


The values in the input file will be separated by blanks. A sample single line in the input file might be:
20.1 78.2 40.1


How would I go about placing 20.1 into jan.totalRain in my array?



I hope I explained myself clearly, If not just let me know.

Thank you all for your help in advance.
Sep 3 '07 #1
1 1189
Ganon11
3,652 Expert 2GB
Access jan by using month[0], feb with month[1], ... dec with month[11]. For your operations, instead of typing jan.totalRain = /* your code here */;, type month[0].totalRain = /* your code here */;
Sep 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a...
3
by: LC | last post by:
hi, i worry about people doing something they shouldn't to my db and I would like to track any structural changes (who and which)to my db. I am using oracle 8.0.6.0.0 and 9.2.0.2.0. regards,...
10
by: davidrubin | last post by:
Structural inheritance (inheriting implementation) is equivalent to composition in that a particular method must either call 'Base::foo' or invoke 'base.foo'. Apparantly, The Literature tells us to...
2
by: adam.spamfree | last post by:
Hi, I was just wondering if anyone could give me an explanation of what the difference between "structural" and "presentational" elements is. thanks a lot.
7
by: Mike McGavin | last post by:
Hi everyone. I'm searching for a quick and dirty way to have psql record the SQL statements that I enter, especially those related to the database structure. My main motivation is to help...
1
by: Hans | last post by:
In developer studio 2003, I created a solution containing a C# windows app. I want to re-engeneer the app using Visio Professional 2003. How can I make visio create the structural diagram??? ...
2
by: Graville | last post by:
All, OK wasn't sure where to post this one but this should hopefully be ok. I am looking for a way to streamline some of the process within our dev team. One of the areas that often takes time...
2
mikek12004
by: mikek12004 | last post by:
Initialy i wanted to create a short description of a text to be shown as preview, I found the following which worked OK $length = 35; // The number of words you want $words = explode(' ',...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.