5,676 Posted Topics
Re: > Which is the best compiler for C++ development for latest versions of OS like the 64 bit windows? Best? What makes you think there's a best? If there was a best, there'd only be one choice. > The DEV C++ compiler is a good option but I find it … | |
Re: > And Labdabeta, what do you mean by arbitrary arithmetic library ? Bad choice of words. He means a large-number arithmetic library? *Arbitrary* is not correct. You want to pick a package with care. | |
Re: First things first: >I am not very fluent in c++ Get fluent in C++. Put the bots on a back burner, you're not even ready for the game yet. 1) Learn C++ extremely well. 2) When you have learned C++, write a few *simple* games. 3) When you're ready, start … | |
Re: Two gold stars. What's next? | |
Re: If people would stop responding to these posts, we could actually do something about them. | |
Re: I'm confused. You enter your number into a string named **string** then start processing a variable named **r**. Where did **r** come from? How do you do math on a string? First thing's first: Write down the steps you take to translate a decimal value into a binary value -- … | |
![]() | Re: Start over. I can't understand what you're doing at all. I've never seen such a complicated fibo program in my life! Most of them are about 5 lines of code. ![]() |
| |
Re: In the loop what is the value of **i**? | |
Re: Why do you need to PM anyone? Getting help is done by posting in the forums. Read the Member Rules. | |
Re: 2 resurrections of a 7 year old thread with "give me the answer" posts show this this thread is a lazy-student magnet. Closed | |
Re: > Any tips on how to solve this? Not without a better description. There is no explanation what **r** contains. You didn't tell us but **a** *seems* to contain your 4 random numbers. The indexes into **zero** and **one** -- are those just guesses? It there any reason those numbers … | |
Re: I already answered this in the other thread in which you asked the same question. | |
Re: Start with [formatting](http://www.gidnetwork.com/b-38.html). | |
Re: This usually means **object** is just a pointer -- there's no storage space. | |
![]() | Re: Now you're begging and screaming at us? Maybe you should do something else... ![]() |
Re: There is no polynomial. It a simple addition or multiplication problem. Convert A to int. Store operator. Convert B to int. Convert Z to int. Calculate A operator B. Compare with Z. Easy-peasy. | |
Re: > bookTitle[SIZE] Every time you specify `bookTitle[SIZE]` you are specifying the memory *just past* your **bookTitle** array. Haven't you been taught about array indecies yet? `while (!filePath.eof()){` -- [See this](http://www.gidnetwork.com/b-58.html) `for(i = 0; i < count; i++){` -- Do you actually know the value of **count**? | |
Re: 1) Dice **is** the plural. *Dices* is chopping vegetables into small cubes. 2) Reread your information about `srand()`. Is it supposed to be where you have it? | |
Re: You are asking two different things expecting to mash them together. Also your initial expectation is wrong.... **%x** is for numbers, not characters. **unsigned char \*s** is a *pointer* to character, but it doesn't actually point to one. It points somewhere but no one knows where. **4200FF** would be 3 … | |
![]() | Re: Where you call `print()` you can `break` out of the loop. |
Re: >here is the insert function I will consider your notes but what is the problem with my code?? You tell us what the problem is. Reading code is hard enough without searching for some unknown error. | |
Re: > ((-b) + sqrt(b*b-4*a*c)) / (2*a) See that **/**? Don't do that. Assign numerator and denominator to separate variables and print them out. num = ((-b) + sqrt(b*b-4*a*c)) den = (2*a) | |
Re: First, create the structure and include all the grades (and all the data) from the file.\* Create the read function to read a student record. Next create a write function that displays the data for 1 student. Write the main function to: 1) read all students 2) display all students … | |
Re: Write a program and find out rather than waiting 7 hours for an answer. | |
Re: I must have missed something. Where is the description of the problem you are having? Is it hidden somewhere? Or are we supposed to read and understand 300 lines of code with no idea what problem we are looking for? I have better things to do. Where's my TV remote...? | |
Re: You use setter and getter methods: class testClass { private: int value; public: int GetValue() { return value; } int SetValue(int v) { value = v; } }; This way the class has total control of the data for safety, but other functions can still access the value. | |
Re: It seems to me that the error "*no instance of overloaded function*" means you have not defined the proper namespace at the beginning of the program. This could cause the 3-parameter `getline()` to be unknown. Also, [see this](http://www.gidnetwork.com/b-58.html) about reading and looping (`feof()` is identical to your (.eofbit`) | |
Re: In addition, if all you want to do is test if switching is better, all you really need is: Loop: get random number 0-2 ; 1 of possible 3 'doors' chosen if number = 0 ; 0 is defined as the good door switchNo = switchNo + 1 ; count … | |
| |
Re: > why root is not NULL? or how can i make it to NULL? Why do you want it to be NULL? You just `malloc`ed some memory and put the address of it into *root*. Do you really want to loose that memory causing a memory leek? ![]() | |
Re: Get your terms straight. You don't "*create the file*" to store it in an array. You open and read an *existing* file to store it in an array. So in detail (excruciating detail) explain the first part of the program you need help with, and show us what you've tried. … | |
Re: > yes, you'll get same value if you use double. I really wish people would learn the details before regurgitating bad information all over these forums. No, double will not correct the problem. Float and double both have the same inexactness problem, just at different levels. It cannot be *solved*. … | |
Re: If you've ever written C/C++, it's no different than writing a string. You just have to remember that \* is also escaped... In C: it's `http:\\\\*`, in markdown it's `http:\\\\\*`. So what's the big deal? ;-) | |
Re: Obviously no one since you were able to post. | |
Re: When you copied the string into *str2*, you neglected to terminate the string with '\0'. So those ? characters were just what happened to be in memory after your string. The `printf()` printed the string until it found a '\0' -- in this case it was close. In other cases … | |
Re: > Can you not just take some code, then go onto different forums (Java, C++) etc.. and ask what the code is, You shouldn't. You should post in a more generic forum (Computer Science) so you post only once. Also, since you don't know what language it is, posting Perl … | |
Re: > whats wrong in my codes 1) `main()` is an INT function 2) `define`ing printf and scanf makes the code difficult to follow and is unnecessarily confusing 3) As **pyTony** mentions, you need to [format your code](http://www.gidnetwork.com/b-38.html) properly. 4) Use a standard function (`getchar()`) instead of the nonstandard `getch()`. That's … | |
Re: > iam not a highly efficient programmer .iam still in learning the beasics. So **learn the basics!!!!** Stop trying to understand how to build an airplane when you barely understand how to ride a bike. You clearly don't understand pointers well yet. Why the hell are you trying to deal … | |
Re: > Context, it's important. So is formatting, since your code is unreadable without it... | |
Re: **MAIN IS NOT A VOID FUNCTION! STOP USING VOID!!!** If you want to program correctly, **USE THE HELP WE'VE GIVEN YOU!!!** | |
Re: Why should it be? Remove MAX and put the macro code directly in your code and see what happens. Post the results. | |
Re: Try printing out avarything you read in as soon as you read it. Can you use STRINGs rather than CHARs? If not, make your CHAR array larger -- say [20]. > ...oh my, Channelling George Takai, I see... ;-) | |
Re: Copy and paste the errors, don't post a screenshot. **Explain** the problem -- don't make us try to figure it out. You cannot nest structures. | |
Re: So what does it do wrong? To get help you need to post details, not just a vague "it doesn't work" message. We need to know **how** it fails in order to understand what "doesn't work" means. | |
Re: > For example, instead of writing a polynomial as follows: > > `a0*x^0 + a1*x^1 + a2*x^2 + a3*x^3 + . . .` > > it would have been nice to write it with the proper subscripts and superscripts. I tried to use HTML code (<sub> and <sup>), but that … | |
Re: In addition to what **The Dragon** said: 1) Never use `conio.h` and `getch()` if at all possible. They are non-standard and are only defined in a couple compilers. Use a standard input function. In your case I understand why you used it, but in general, *avoid `getch()`* 2) Line up … | |
Re: If your sort key is short, you can loop to 1a) remember line position (ftell) 1b) read line 1c) extract the key put both key & position in a structure array Now sort the structure Read each line from the the line position (fseek) and write the sorted file. I … | |
The End.