- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 9
- Posts with Upvotes
- 9
- Upvoting Members
- 8
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Your best friend.
- Interests
- AI, sleeping, American comics, Japanese animation, football (soccer), video games, and hard rock music.
- PC Specs
- Macbook Pro 4,1 Mac OSX: Snow Leopard, Windows 7 Professional
Re: As mentioned, you were trying to assign an integer to a pointer rather than dereferencing the pointer to store the value. | |
Re: @Gonbe: Why'd you give out an answer? This seems like an assignment, so why not let him/her do the work themselves and post it here if they need additional help? | |
Re: You only set mid once, and that was outside of any loop, so it doesn't update when last or first changes. | |
Re: Why not use a list of strings rather than a character array? The list class is made for fast insertion and deletion, without you having to worry about shifting values continually. | |
Re: Your asking the user to enter a grade, then testing the array's data before they even enter any information. Once you declare your array, its data is going to be garbage, so that's what you'll be testing against. | |
Re: [QUOTE=NathanOliver;1682830]So in your example a and b are both 10. You add them together and you get 20. Now you want to set a and b to 20 and do it again?[/QUOTE] I think it's more on the line of adding the result of a + b to a + … | |
Re: You have to set c to 0, because it needs to increment until it counts the amount of characters in cols. When it reaches that amount, then you've finished printing one line. As for c += greeting.size();, c is incremented by the amount of the "greeting" since in the previous … | |
Re: What questions do you have about arrays, classes, and stacks? | |
Re: You could always just test for the student with the longest name, and find the difference in spacing between that name and every other name. In doing so, you can print the correct amount of spaces after each person's name, followed by the list of grades. Good luck. P.S. I'm … | |
Re: It seems like most of the work is already done. Make some attempt at the code, post it, and we'll give assistance if need be. | |
Re: InitWord[50] is invalid, in this case, since your array is actually from 0-49. Also, if you want to copy the word to the struct member, you can use strcpy. Lastly, if you're trying to pass that array to InsertItem, then you'd need to pass a pointer to it and the … | |
Re: There is no pAVec member in your class, and neither was one passed to the member function test. | |
Re: It's based on the type of the variable. They each have their limits. | |
Re: If your list is generic, then you wouldn't necessarily need to specify the particular class object would you? What do you have there that is a substitute for the name of a type? | |
Re: It means that the variable direction is default initialized with the character 'A', if you don't pass a character as an argument to the function. If you do, it replaces that value with the one the caller (you) provided. | |
Re: The point wasn't to do the program for the person asking, though. | |
Re: Your string and list are empty when you test for their size. Also, you've only opened the file. Where did you read from it? | |
Re: There's a semi-colon after your string. Remove it. Also, separate your variables in output by << operators and not semi-colons. | |
Re: Your code tags isn't structured properly. Also, I'll give a hint. Work it out by hand first. Assume the first population is 755, for instance, and using what you know about the arithmetic operators, find a way to round to 1000. By finding it for this case, you can work … | |
Re: In your catch statement, you referred to e but you never used it. Instead of [CODE]cout << "exception handled" << endl;[/CODE] try [CODE]cout << e.what() << endl;[/CODE] That should display the error string that you threw. If you want to specify it as an error, you could use cerr instead … | |
Re: You could use an associative container, such as a map, that has unique key values (in your case integers). The container is self-ordering, so by testing the difference between each successive key value (integer), you can find out which integer you'd need to search for next if their difference isn't … | |
Re: You should pick a better name for your string other than "string", just to be safe. Aside from that, you're indexing your string so each index corresponds to a specific character, in the case of string[7] it'll be 5 and string[8] will be *. If you want 45, you can … | |
Re: In your example, you're neglecting to test if the die rolls on a 6 in your if statement. Also, rather than using [CODE]num < 6 && num > 0[/CODE], try: [CODE]if ((num >= 1) && (num <= 6)) { // rolls on a correct die value }[/CODE] Also, keep in … | |
Re: If your if statement has to execute multiple statements, then enclose those in braces. | |
Re: Make an attempt before asking for help, or ask questions about the language details, so you can get a better understanding. | |
Re: Review the link that was posted before to get a better handling on loops, then try doing your program again. | |
Re: There's some syntax problems with your program that you should handle beforehand. In each of your condition statements, make sure you're using == signifying equals rather than = meaning assignment. Also, cout uses the ostream operator << whereas cin uses the istream operator >>. In addition, it's "cin.get()" rather than … | |
Re: If you're trying to pass the array to the function, you should just pass the name of the array "levelOnePlatform" as the first argument and 50, as the second argument which is its size. |