• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Updating an array  RSS feed

 
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys new to C++ and wondering how to update an array in a function. I am trying to update the time for a flight given in a text file. Here is the code I have so far.




If more code is needed I can upload... however I do not want to put all of my code on here to encourage others to do their homework. Thank you for your time and help.
 
Ranch Hand
Posts: 92
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rhyeca

Slightly off topic, but in some ways it looks more like C than C++. For example, C++ provides classes such as std::vector which effectively replace arrays for code such as this, making the programmer's life easier. And I would expect those string fields in your FlightType structure to be type std::string.

Returning to your question, sorry, I'm not sure what you mean by 'update'. If you know the index of your array entry, just write to one of its fields using something like:
But I'm guessing that wasn't what you were asking; please could you clarify?

Cheers
John
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!