- Upvotes Received
- 6
- Posts with Upvotes
- 5
- Upvoting Members
- 4
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
13 Posted Topics
Re: If you must use char arrays instead of strings you need to use strcpy(char* dest, char* source) from stdlib to assign values instead of the = operator you have now. With strings you could do str="abc". | |
Re: Check your brackets again, It looks like you have 4-{ and only 3-}. | |
Re: First off you are %ing by the wrong number rand()%y will generate a random number between 0 and y-1. Second your loop is only filling in 39 of the 40 values you have allocated to your arrays. Third (0 rand() % 9) will give you an error because there is … | |
Re: If you know ahead of time the maximum number of strings you will input and the maximum length of each string you can make a 2D array of chars as follows [CODE]char arr[max strings][max length]; [/CODE] then you can use [CODE]scanf("%s", &arr[l])[/CODE] to input each string and the same for … | |
Re: Apparently what I've read on another site is that including iostream.h has be deprecated from gcc(3.x) and newer. I believe in the older versions iostream with no suffix used to simply include iostream.h itself so you could include iostream.h in your program with no errors. now all of the declarations … | |
Re: Have you tried to do anything yet, I'd like to help but I won't do you program from start to finish. It looks like it could be solved using a 0-1 knapsack with slight modification for the heights changing as you pick. If you post some code you're working/stuck on … | |
Re: In most languages integer division returns the floor or rounded down integer so 3001/1000 = 3.xxx which as a rounded down integer is just 3. | |
Re: You are reading a char when you first test for EOF to see if the file is empty and never put that char in your line or add it to the count. Just initialize count_char_line to 1 and set oneline[0] to c before you enter the do loop. | |
Re: Without going through all of your code I can see that your using >> instead of just > for testing greater than and less than so your miles >> 1000 is shifting your miles int 1000 bits to the right which will always make it zero. Try fixing this and … | |
Re: You're second thought sounds correct. Loop inputting a number each time and add it to the sum until the current number entered is 999, then stop input and output the sum making sure to either not add 999 to the sum or subract it off after you break the loop. | |
Re: This will solve your collision problem. When a record is added its pNext pointer is allocated and id set to EMPTY, this way you can simply iterate the list til you get to the EMPTY id and insert your new data in this record. [CODE] void insert_to_hash_table(HashTable* ht, Student* record) … | |
Re: You've included a lot of code that is called and shows that there is an issue, but I'd like to see the function called when option 5 is selected to add a new card. I'd almost bet that the problem is that you're cards id variable is never set so … | |
Re: When you use a class that you've created you need to make an object of that type in you're main function. [CODE]Pib myPib[/CODE] then test can be called with [CODE]myPib.test()[/CODE] |
The End.