- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 35
- Posts with Upvotes
- 29
- Upvoting Members
- 26
- Downvotes Received
- 5
- Posts with Downvotes
- 5
- Downvoting Members
- 2
Re: [QUOTE=rfrapp;1722891]I see that the square, in this case, is a 9 x 9 square, and that each descending number appears as a multiple of 8 (There are 8 4's, 16 3's, 24 2's, and 32 1's), but i'm not sure of any other patterns. Im sorry, I'm not much of … | |
Re: Every appliance has a watt rating listed on it somewhere. Watts tells how fast the electricity is being used, that is, at what rate. It's like a faucet that's running water, the "watts" would be the number of gallons coming out of the tap per minute. Turning the facuet on … | |
Hello, I'm trying to create a data area within an .exe file. Then I will open the .exe file and scan it for the data area. When the data area is found, I will write some data to this data area and write the .exe file back to disk. I … | |
Is double pre-incrementing undefined behavior? Like ++++x or even ++++++++x. I think it must be since it all occurs between sequence points. But what could possibly go wrong? Or do you just not ask that question and automatically stay away from any undefined operations? Is double incrementing ever routinely used? … | |
Re: **b=a++ will first initialise value of a to b then a get incremented** should actually read: b=a++ will first initialise b to the value of a then a gets incremented. | |
Re: Here is a slightly modified version of your code (in the function **fun**): #include<iostream> using namespace std; int& fun() { static int x = 10; cout << "In fun x = " << x << endl; return x; } int main() { fun() = 30; cout << fun(); return 0; … | |
Re: > then whats the difference between using namespace and #include? doesnt #include also tells c++ to go look in this header file for this function or statement...Quoted Text Here No, it doesn't tell the compiler to go look anywhere - the header file is simply "included" in the source file. … | |
Re: Of course, you will need to be able to determine if the integer is even or odd. Can some mathematical operation (add, subtract, multiply or divide) be done on the integer to determine if it is even or odd? (The answer of course is yes : ) | |
Re: Generally, you connect C++ code to circuitry by storing it inside a memory. Then some circuitry will read that code line by line and do what it says. A microcontroller is like that, it's a computer on a chip and will be under the control of the code stored in … | |
| Re: As a program gets more complex, it's a good idea to use prototypes. One reason to use prototypes is because it makes it easier to see what parameters any particular function uses. If all of your prototypes are in alphabetical order and listed one after the other, it's easy to … |
Re: Declaring variables is to create them which brings them into existence. You have to specify the type of variable that you are creating. There are different types because there are different types of data to be represented. For example, there are integers which are simply whole numbers (like 1,2,3, 86, … | |
Re: Once you change fstream.h to fstream the program reads the file (for me anyway). If it still doesn't read the file for you as you stated, then there is another problem unrelated to "using namespace std" and "fstream". Maybe your doc.txt file is not in the right path and so … | |
Re: Well, consider this: When you pass a pointer to a function, that pointer is being passed by value. So which is faster, passing a pointer by value or passing a value by value? I don't see how a pointer can be faster. If I am figuring this right, when the … | |
Re: In line 40, in your function box_vol, the two identifiers "l" and "w" are strangers there. Once you are inside of the function, there is no way to see outside of it. So any mention of "l" and "w" outside of the function is not observable from within the function, … | |
Re: You don't just write some code to send a HIGH output to a USB port. In days gone by you could simply write some code to send a byte to the parallel printer port, or more commonly to a serial port (com1 or com2). But things have gotten at lot … | |
Re: I miss Narue. I wish she would come back and give us a piece of her sassy mind. | |
Re: This code: **cout<<(x=(x>='A'&&x<='Z')?x+=' ':x-=' ')** works like this: if(x = capital_letter) cout << x + 32; else cout << x - 32; Because this kind of "if" construct is used so often, the designers of C developed this statement using the conditional operator **?**: x = (test condition) ? 5 … | |
Re: The right most digit is the 1 or 0 that is being compressed, and the remaining 3 digits to the left code how many of those 1's or 0's there are. 1011 = 101 1's - i.e., 5 ones. 1110 = 111 0's - i.e., 7 zeros. | |
Re: > If I have a function such as Funct(int *arg1, int *arg2) , how do I use this function in a program. > You use this function the same way you use any function, you pass the specified parameter(s) to it. If the two parameters are pointers (to an int) … | |
Re: In line 13 you are assigning the value of **triangle** to **shape1**. The problem is, **triangle** doesn't even exist (at least not at this point) so the compiler is complaining that **triangle** has not been defined (i.e., brought into existance). | |
Re: Sorry, you have to help yourself first. Make an effort at writing the code yourself, and post it here so we can see it and help you to carry on. | |
Re: Basically, what you could do is just declare your three variables in main(), since that is where you want them. Then, with the long arm of your function, reach all the way over into main() and manipulate those variables directly. You do this by passing a **reference** or **pointer** to … | |
Re: Look at your **if** statements - at least one of them has to execute in order to *not* print twice. So if there is a double printout, then neither **if** executed, thus both **elses** did. Frankly, I think something else is going on somewhere else in the code which isn't … | |
Re: Windows will keep an eye on your data accesses and if you go outside the bounds of your program's allocated space Windows will shut it down ("Your program has encountered a problem and needs to close"). Because Windows is a multitasking operating system it won't allow a program to mess … | |
Re: > You are asked to write a program that manages a company's stock... So ..... what's the hold up? | |
Re: if(true) do_this; else if(true) do_this; else if(true) do_this; else if(true) do_this; else if(true) do_this; This is called a decesion tree, and only one if statement will execute out of the whole bunch. When one of the if statements does execute, then control drops out to the bottom bypassing all the … | |
Re: Well, if you really want to learn, then I think we should start learning the basics of electronics, since computers are electronic. Once you know some electronics, we can breadboard some simple digital circuits, like “and" and “or” gates and some simple adders and flip flops, counters, etc. Then we … | |
Re: Also, whatever algorithm you use to generate lines 1 - 4 you may be able to use for lines 6 - 9 by just reversing the "direction". | |
Re: Maybe strings are giving you errors because you forgot to declare them - just like you forgot to post your code. | |
Re: Each of your two .cpp files are treated as separate source files by the compiler and are compiled separately. In each source file you have included "Resistor.h", and thus in each source file those objects in "Resistor.h" are created. No problem until the linker trys to combine the two compiled … |