Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Updating an array  RSS feed

 
Ranch Hand
Posts: 34
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: 103
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
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!