Crazy_Learner's Profile
Reputation: 9
Worker
- Group:
- Authors
- Active Posts:
- 139 (0.1 per day)
- Joined:
- 25-July 09
- Profile Views:
- 3,750
- Last Active:
Aug 30 2012 06:50 AM- Currently:
- Offline
Previous Fields
- Country:
- US
- OS Preference:
- Linux
- Favorite Browser:
- Chrome
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Playstation
- Your Car:
- Mitsubishi
- Dream Kudos:
- 100
Latest Visitors
-
Aphex19 
15 Feb 2012 - 04:28 -
RudiVisser 
29 Sep 2011 - 12:04 -
CodingSup3rna... 
11 Sep 2011 - 04:28 -
H3O 
27 Jan 2011 - 02:35
Posts I've Made
-
In Topic: Item not return correct value
Posted 24 Feb 2012
-
In Topic: Item not return correct value
Posted 24 Feb 2012
I can do that from now on, but the error was exactly what i posted:
Quote
segmentation access error and it points to the Item class getItemCount() method
which is accessed from the inventory class during the getInventoryItemCount method -
In Topic: Item not return correct value
Posted 24 Feb 2012
jimblumberg, on 24 February 2012 - 06:35 PM, said:Show your current code, along with any warning/error messages exactly as they appear in your development environment.
Jim
Code is updated in first post and the the only error i get is from debug mode, not the compiler of segmentation access error and it points to the Item class getItemCount() method -
In Topic: computer programming 101 problem with switch statement and if-else
Posted 24 Feb 2012
i dont think that if statement would fulfill the requirements as you are already checking a value that has been checked by the case statement. Not to mention if it value was lower case it would not execute because the case is looking for an upper case.
also in case I you forgot the closing bracket for your if statement
case 'I': if (waterType=='I'||waterType=='i'){ if (waterUse<=1000000) cout << "Amount Due:$1000\n"; else if ((waterUse>=1000001)&&(waterUse<=10000000)) cout << "Amount Due:$2000\n"; else waterUse>10000001; cout << "Amount Due:$3000\n"; } // This is the one you forgot to add break; -
In Topic: Item not return correct value
Posted 24 Feb 2012
jimblumberg, on 24 February 2012 - 05:33 PM, said:First I recommend that you stop using the C-strings and start using std::string. You can not use assignment with C-strings, you will need to use strcpy() from the cstring header. Second in your item class you have a pointer variable that you never allocate any memory ( char* ItemName;). How many characters will this variable be able to hold?
Jim
taking in account your suggestion and adjusting the code to fit the std::string, i still receive a count of zero, when adding the item. even though the char* was deprecated it was always return the proper name. although i still changed it. what my issue lies in is that i am giving the inventory 15 of the same item, and then when i check it there are 0
My Information
- Member Title:
- D.I.C Head
- Age:
- 23 years old
- Birthday:
- November 26, 1989
- Gender:
-
- Location:
- Evans, Georia
- Years Programming:
- 3
- Programming Languages:
- C#,Java SE
Contact Information
- E-mail:
- Private
- Website URL:
-
http://programmersfirststep.orgfree.com
Friends
Crazy_Learner hasn't added any friends yet.
|
|


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