- Strength to Increase Rep
- +4
- Strength to Decrease Rep
- -1
- Upvotes Received
- 6
- Posts with Upvotes
- 5
- Upvoting Members
- 6
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
64 Posted Topics
Re: I am teaching myself C++ with the very same book and did that very exercise yesterday. One of the 3 'run-time' errors, as opposed to the 5 'compile-time' errors, is that not all of the possible cases are accounted for. The calculator won't recognize a certain digit as a valid … | |
Last week the New York Times semed to skewer Amazon over the stress it places on its workers. I read today that Dustin Mosokvitz confirms such high stress work environments and confesses that his health deteriorated while at Facebook as a result. I don't work in IT but I hope … | |
In my continuing quest to improve my understanding of OPP in PHP, I have developed another project. It is closer to my field and a real life project I hope to develop, than my previous post using geometric shapes. This draft program is the simplest version. I want to increase … | |
I want to increase my knowledge of PHP by learning about classes. I wrote the following very simple test program. It works. But I would like to know improve it. I plan on writing more complex test programs and that won't be the time to iron out smaller issues. Thanks … ![]() | |
Hello All, My old computer crashed. I installed XAMMP on my new computer. My old PHP files don't run. I learned that the reason is that register_globals feature has been deprecated and is now permanently Off by default. My old files were written in a 'register_globals=On' environment. I understand that … | |
Re: What Guy said is correct on the surface. Underneath is a different story. I have an ad campaign for the homepage of the small site I manage and ads for 5 other landing pages. The landing pages are more specific than the homepage, as Guy advises. The problem is that … | |
I have a form with several inputs. One has a sub-input based on the condition of the original input. An example is: <input onChange="javascript:addRow()"/> The JS function works. function addRow() { Dynamic HTML code ... } However, if the original input is modified a second time, the JS function executes … | |
I have a problem that includes finding the maximums and minimums of certain variables in sequence. I want to nest the max() and min() functions as follows. $variable5 = min(max(($variable1 - $variable0), 0), $variable3); The PHP manual says/suggests that this type of nesting is possible. However, the code doesn't run … | |
I have a script in which I would like new code to appear based on the response to a question. I am using 'onChange' to trigger the event. The difficulties I am having are that: 1) The format of the form changes after the event. I would like the new … | |
Re: I have AdSense on a small website I manage. I don't understand the large variance in the revenue per click that I am experiencing. I can earn $10 on a total of 10 clicks one day, and yet earn only $5 on a total of 25 clicks another day. I … | |
I have searched for and read through over 50 examples of linked lists. I can barely make heads or tails out of them. Some are in C, some are in Java, some use templates, most only discuss theory and display flowcharts but have few explained examples. I need serious help! … | |
Re: I'm late on this but here is my $0.02 anyway. Moschops is right that this is the same as the Birthday Problem. However, this is NOT a C++ problem, or even a computer programming problem. It is a probability problem. The probability solution involves dividing the 1000 songs into 2 … | |
I am teaching myself C++ and wrote a program that does the queue data structure. It runs corectly. I would like some feedback on how I can improve the program to make it run faster, use fewer lines of code, or be clearer to someone else. I haven't added my … | |
I am teaching myself C++ and amd now trying to simple programs related to data structures. I wrote this code for a simple stack. It is not working. I am frustrated and tired so I cannot think through the issue. There are two main problems with which I need help. … | |
I would like to express a superscript and a subscript in the same vertical space. For example, consider a variable called X with a subscript 1 that is squared. I have searched for examples of what I want to do but cannot find anything close. [code] X<sub>1</sub><sup>2</sup> [/code] The above … | |
I am organizing my site to make it easier and faster to maintain. I keep a small version of my site on my laptop running Apache/PHP. I successfully organized and recoded things to the way I wanted. Upon uploading the file to my live site, I ran into several problems. … | |
Hi. This is not a frequently browsed category, but there is no place else for my question. I am organizing my site to make it easier and faster to maintain. I keep a small version of my site on my laptop running Apache/PHP. I successfully organized and recoded things to … | |
Re: Narue, Thank you very much for your outstanding explanation of pointers. Like the OP, I am also self-learning C++. Your post has raised my understanding of pointers several levels, as the books and tutorials I read were nowhere near as clear. I have a follow-up question. (Not to hi-jack the … | |
![]() | Re: I manage a small website. I participate in forums that are relevant to our business. [B]ALL[/B] these forums prohibit advertising in the posts. That includes links to a site that you reference in your post. They force you to buy advertising on their site. I have also written 2 or … |
Re: I was going to suggest exactly what MrIdul posted above. It may take some effort to write the loops for sine and cosine to the degree of precision you need, unless you have experience with the infinite series topic in advanced calculus. | |
Re: [QUOTE=ShaRp codeR;1674041]Thanks guys, i figured it out how to show "1000" under principal. Thanks for the help.[/QUOTE] That was not your only error. The principal balance at the beginning of a month should be equal to the remaining balance at the end of the prior month. Your output does not … | |
Re: I recently faced a similar issue when I was learning about page layout using CSS. As I understand it, and I may not be understanding it fully or correctly, when you are using relative positioning, you can use negative margins. That is because the margin anchor (top left) will be … | |
I am developing my own project for the practice. I am having a great deal of difficulty conceptualizing the classes I want. The scenario is that of 2 countries, each capable of producing 2 goods, using 2 factors of production. Specifically, Lower Mongolia and Upper Mongolia have certain amounts of … | |
I have made revisions to my program. I gave up on the idea of using functions that return arrays. That was far too complicated for the expected benefit. This latest version compiles and runs correctly with all of the provisions required by the exercise. What remains is feedback on the … | |
This is part of my Wumpus Hunt program. Suggestions were to clean up the main() part of the program by creating functions. I am working on that and ran into this difficulty (for me). The functions that relate to the rooms of the game need to return an array. I … | |
I was already thinking along ARKoenig's suggestion and revised my code to use arrays. It was working pretty well until I made some minor changes. Now it loops non-stop without any prompt for the player to make a play. I am sure it is a small error, but I can't … | |
Is it possible to have an array as a class member? It is part of my Wumpus Hunt exercise. I want to do the following: [code] class Room { blah blah; }; int main() { for (i = 0; i < 3; i++) { Room adjacent[i]; blah blah; } [/code] … | |
Stroustrup has an exercise in which the reader writes a program for the wumpus hunt game. A first draft of my code is below. It compiles and runs partly correctly. If you choose to move to a different room the program runs as expected. If you choose to shoot at … | |
I have a difficulty I need help to overcome. I am developing a program that uses more than 1 class. Variables defined in one class are used in other classes. For example: [code] class X1 { private: int a; int b; public; X1() { a = 10; b = 20; … | |
An exercise that Stroustrup wants the reader to do is understand the output of the following program. [code] #include "../../std_lib_facilities.h" struct X { int val; void out(const string& s, int nv) { cerr << this << "->" << s << ":" << val << "(" << nv << ")\n"; } … | |
Re: This is a common assignment. I'll bet if you had searched for examples of prime number generator programs, you would have found many to which you could compare your code and see where you went wrong. Recall the definition of a prime number, one that is evenly divisible only by … | |
Re: Instead of all the else if statements, I would have used a switch statement. | |
An exercise is to write a program that shows how memory is allocated to stack variables compared to heap variables. I ran the following code. [code] #include "../../std_lib_facilities.h" int main () { char c = ' '; char ch0[10]; char *ch = new char[10]; char *init_ch = ch; cout << … | |
Re: I would add that a switch statement is preferable to a long series of if statements. | |
OK. I thought I understood pointers and such but this exercise is revealing that I do not. The task is to read characters into an array created on free store memory (heap), then print them out using the reference and dereference operators. My code (below) compiles and runs but does … | |
This is a follow-up exercise to the one related to reference and dereference operators. Stroustrup asks the reader to modify that program to handle an array overflow. He wants us to specifically use the realloc() function. I read the tutorial here but didn't understand the example. I read other web … | |
Re: I would use a while loop as in: [code] int i = 0; while (temp < 0.0001) { temp = pow(-1,i) * (pow(x,i*2+2)) / (fac(i*2+2)); cos += temp; i++; } [/code] | |
Re: It looks mostly fine to me. I am still learning C++ but based on the complexity of your program, I think I am slightly more advance than you right now. Does your code compile and run, giving the correct result? I am suspicious about your [CODE]cin[/CODE] statements on lines 16 … | |
An exercise in Stroupstrup's book is to write a program involving memory allocation with an infinite loop and let it run until it crashes. He says the crash will be due to [i]memory exhaustion[/i]. He also suggests researching the topic. I did and am frightened by what I found. The … | |
Re: @csurfer, A question in Stroupstrup's book, that I was not considering trying, is: Which way does the stack grow? Which way does the free store (heap) grow? Write a program to that answers those questions. What you just said about stack and heap growing from opposite ends suggests that this … | |
Re: I have this arrangement on the site I manage. I agree with fobos that the best strategy is to have your visitors sign up for free content and then separately pay for non-free content. Unless you have expertise in SSL and credit verification, I [B]STRONGLY[/B] suggest you use a payment … | |
I am trying to do an exercise in Stroustrup's book. The task is to create two arrays (with different values) and pointers to each array, and copy the first array to the second using the pointer and reference operators. My code is below. [code] #include "../../std_lib_facilities.h" int main () { … | |
I am trying to do an exercise from Stroustup's book. The task is to create an array of 7 ints, assign its address to another variable, then print out the array value and the address. My code is below. [code] int main () { int p0[7] = {0, 0, 0, … | |
I would like to place a caret (^) above certain characters in my text. The text decoration options I find are underline, overline, and strike-through. I also find ASCII characters with carets but theses are only vowels, and I would like any character to have a caret. Is it possible … | |
Re: I had a similar problem which I think I posted here. The recommended solution, which worked, was to use a [I]cin.clear()[/I] statement to empty the input buffer so [I]cin >>[/I] can be used again. Why is [I]cin.ignore[/I] the solution for this problem? Does [I]cin.ignore[/I] also empty the input buffer? | |
I am reading the first chapter on graphics in the Stroustrup book. He explains that we students will need to download the files of a GUI toolkit in order to run programs containing graphics. He recommends the "Fast Light Tool Kit, FLTK" because the book's programs are based on that … | |
I manage a small website. I went over the logs this morning and found a page reference on the site that should not have been there. It was of the format "/xmlrpc.php". I did a search for the term and found the XMLRPC website. I didn't understand what was written … | |
I manage a small website. I went over the logs this morning and found a number of pages or page references on the site that should not have been there. Most were of the format "/_vti_bin/". I did a search for the term and learned about the Front Page debacle. … | |
I hope this is the correct forum for this question. I manage a small website. The site uses a database with MySql. When I launched the site, around 3 years ago, the PHP code I wrote had minimal security and validation in PHP because I relied on javascript validation for … | |
I am doing an exercise from Stroustrup's book. It is the drill from chapter 10 on input and output streams. The program I wrote compiles but crashes when it reaches the prompt for the output file name. My IDE (VC++ Express) simply says there is an unhandled exception yielding a … |
The End.