- 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
104 Posted Topics
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 … | |
Re: Check that all of the variables have been initalized before use. | |
Re: When you get the file from the desktop, is the file to be printed to the screen, to the printer or sent somewhere else? What line in your code shows this? | |
Re: HELP!! C++ HELP NEEDED URGENTLY No this is not a school assignment...just something i thought i'd practice | |
Re: You should post all of your code the way it actually appears so we can check it out. A misspelling or a missed ";" can give weird errors. | |
Re: On line 41, **while** should be on the other side of the closing brace, like this: } **while(ans == 'y')**. Fix that and see if that corrects the problem. Also, the closing brace for main() doesn't have a "**;**" after it. Remove that too. | |
Re: Just include the <string> header - #include<string> | |
Re: Each source file is compiled separately, so only the file that has the included header will have "var". And only one file can have the header file included. | |
Re: Yes, I would do a bubblesort. If you have five numbers, 84692, you would basically sort them like this: compare the 8 and 4, if 8 is greater then swap them - 48692 compare the 8 and 6, if 8 is greater then swap them - 46892 compare the 8 … | |
Re: If you have source code written in a high level language like C++, then: You would use compiler A to translate it into machine code that processor A understands........ You would use compiler B to translate it into machine code that processor B understands........ You would use compiler C to … | |
Re: You probably got your settings wrong to start with. When creating a new project, select **Win32** in the left pane of the New Project window. Then select **Win32 Console Application** in the middle pane. Give it a name and then click on **OK**. In the next window (Application Wizard), click … | |
Re: OK, here is why your program is doing what it's doing: In line 7, **row** is set to 1, then the **for** loop at line 9 loops 5 times, and when it does, **row** does not change, does it? After the **for** loop at line 9 loops 5 times then … | |
Re: I know it's already been 3 weeks, but if you are still interested, here is a short tutorial on arrays that I did in response to a poster about a month ago for C++ : [Click Here](http://www.daniweb.com/software-development/cpp/threads/417558/confused-by-multi-dimensional-array#post1781268) | |
Re: Case_1 isn't really accurate when you say foo() doesn't return a value SO it prints a garbage vaule, because functions often change the value of a variable directly without ever returning a value. This is accomplished by using pointers and refereneces, or by directly changing a global variable. So the … | |
Re: Your two functions, findMax() and findMin(), take a pointer as the first parameter because when passing an array to a function the whole array is not passed, but just a pointer to the start of the array. So the first parameter in those two functions are pointers and you are … | |
Re: Is this about knowing whether or not a program has been run before or is this about something else? | |
Re: The basic problem here is that Windows will not allow your program to modify itself, or else it will generate and access violation. So one solution to that might be for the program to load a copy of itself into a data area and then modify that. Then just save … | |
Re: Come on, you can do better than that. This isn't rocket science. | |
Re: If you want to avoid "weird" errors, then don't do anything weird. LOL. You can't put program code into arrays, but you can put pointers to program code (functions) into arrays. The functions pointed to can contain the if statements. | |
Re: If you are referring to the function "frequencyArray" then it will always return zero because the variable "frequency" that is being returned has been initialized to zero and never changes throughout the function. | |
Re: The third if statement is the same as the fourth if statement, so if the third if statements prints then so does the fourth. if (b < a && b < c && a < c) is the same as if (b < a && b < c && a … |
The End.