codescout's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 46 (0.2 per day)
- Joined:
- 02-October 12
- Profile Views:
- 155
- Last Active:
Mar 08 2013 05:19 PM- Currently:
- Offline
Previous Fields
- Country:
- Who Cares
- OS Preference:
- Windows
- Favorite Browser:
- Mozilla
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: returning specific data from file
Posted 8 Mar 2013
Awesome, will work on that. Thanks. -
In Topic: returning specific data from file
Posted 8 Mar 2013
Thanks for the structs info, that made it easier to organize.
When I read the files in and go through a loop to move data from input files to temp file, will I need to push_back all the pieces of the data or just the pieces I need?
The names correspond to the numbers: Jacob has 32509 in 2001 and Jacob has 30541 in 2002......I have to add all of Jacob's numbers together then display Jacob has 90687 in the output. -
In Topic: returning specific data from file
Posted 8 Mar 2013
I was trying to find a way of keeping the number that follows the boyName with that particular name because that number has to be totaled and listed with that name in display.
The instructions say to display rank, name, and total number that name has for the 10 years.
Rank has to be determined by which name has the highest number count.
I used a template so that I could store strings and int, vector in a vector. The for loops simply total the numbers that match the name.
Is there a better way?
Would a struct work? Where can I learn about structs, the tutorials are limited? -
In Topic: returning specific data from file
Posted 7 Mar 2013
Sorry for the delay.
@define - I don't know anything about structs yet, really new to c++, and don't know the best way to use arrays/vectors to solve this. That's why I came to the experts.
So far I have 2 vector<vector<T>> one for boy one for girl. Getting "unresolved externals" or no output at all. Any recommendations??
while (input >> rank >> boyName >> boyCount >> girlName >> girlCount){ for (int i = 0; i < sizeof(filename); i++) { for (int j = 0; j < sizeof(filename); j++) { boysNames[i].push_back(boyName); girlsNames[i].push_back(girlName); } boysNames[j].push_back(boyCount); girlsNames[j].push_back(girlCount); } for (int k = 0; k < sizeof(filename); k++) { if(boysNames[k] == boyName){ int totalBoyCount += boyCount[k]; } if(girlsNames[k] == girlName){ int totalGirlCount += girlCount[k]; -
In Topic: returning specific data from file
Posted 7 Mar 2013
If anyone can help??
while (input >> rank >> boyName >> boyCount >> girlName >> girlCount){ boysNames.push_back(boyName); girlsNames.push_back(girlName); if(boysNames[i] == boyName){ boyCount += boyCount; } if(girlsNames[i] == girlName){ girlCount += girlCount; } input.close();
Will this save the boyName and corresponding boyCount for future use?
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
Contact Information
- E-mail:
- Private
Friends
codescout hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
codescout has no profile comments yet. Why not say hello?