• 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
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Updating an array  RSS feed

 
Ranch Hand
Posts: 37
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: 116
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
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!