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

c++ program take string input,place in two vectors,separate columns

i have this hw problem for class thats supposed to read a comma separated list of my cd collection
ex.: artist,album
artist,album
artist,album
it reads that into a string and then has to separate the artists into one vector and the album into another and then place the artist vector in one column and the album vector into another column
i think i can do the column part but i have no clue how to separate the whole thing into two vectors. could you please give me some suggestions on how to do this.
thanks
Oct 8 '08 #1
3 2305
Studlyami
464 Expert 256MB
How would you solve this problem in real life (not thinking about programming).

You would have a CD collection
In your CD collection you would have multiple artists and you could have multiple cd's from an artist. Break the assignment down into steps and post them here. Also, you can have a vector of a vector perhaps this can help. Break this down into steps and work out some code and post that as well and we will help guide you where you get stuck. Good Luck!
Oct 8 '08 #2
yea i understand the assignment i just dont know how to break the input into two separate vectors. i have no clue where to even start doing that. iv got as far as declaring the vectors and the string and reading the input into the string and thats it, i need to know where to go from there.
thanks
Oct 8 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
Each record in the file has an artist and an album. One artist can have many albums.

Fist associate the artist with the album. Research the pair<> container.

Then create a vector of pairs.
Oct 8 '08 #4

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

Similar topics

14
by: 1111111111 | last post by:
Write a program that will do the following; Ask user to enter a FIVE DIGIT integer (from 11111 to 99999) Separate the number into its individual digits and Print the digits separated from one...
6
by: hoover_richard | last post by:
I am a newbie to C++ and I need help with a simple program I am trying to write. My program is designed to print all of the odd integers contained in an array and output the sum of the odd...
10
by: Son of Sam | last post by:
Ok what does the program do: opens a file binary, jumps to an specific offset (0x3529BC9) reads out the string which is 7 bytes (7 chars) long (which starts at the offset), then generates a random...
7
by: jmac | last post by:
Greetings fellow programmers, I have created a C program that has a few bugs and would like to get some help with working them out. Here is a list of the problems that I am experiencing: -...
16
by: Martin Jørgensen | last post by:
Hi, I get this using g++: main.cpp:9: error: new types may not be defined in a return type main.cpp:9: note: (perhaps a semicolon is missing after the definition of 'vector') main.cpp:9:...
7
by: mturner64 | last post by:
I have an assignment that is due tomorrow (Friday). The details are as follows: ...................................................................................................................
9
by: seep | last post by:
hi i m finding following error on the code that i wants to use to get all record from table via store procedure with paging. the error is : Input string was not in a correct...
0
by: Frank Birbacher | last post by:
Hi! sphenxes@gmail.com schrieb: Why is the referenceNumber a string? Are there always *exactly* six alternatives? The alternatives could be a std::deque which can resize as needed.
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.