" data-bs-original-title="" title="">
My friend made this one (a little quality lost in resize): 
The issue is on line 26. You check if the sign isnt + OR isnt - OR isnt etc.. you want ANDs there. :)
Okay... first of all this forum really isn't for just giving away free code, so I doubt anybody will just give you the solution. Now, I assume you are familiar with c++, but judging by your question it is hard to tell. For instance, how are you storing your matrices? …
Hello. I have been looking long and hard for an image library that meets these criteria that I have for pretty much any library I will use (with some obvious exceptions): A) Cross-Platform (If at all possible) B) Weightless (or nearly weightless) C) Stand-alone (I hate having to include DLLs …
I only recently learned to use GUIs but for the most part I think that it is a complomise. I use photoshop to create my images/textures then load them into my program. For 2d programs I usually draw out my view by hand to try to find out where to …
I think what Nathan Oliver was trying to say is that cin>>X; and getline(X,Y) do not mix very well. This is because of how those functions modify the internal pointer for cin. Putting cin.get() (without arguments) can sometimes rectify the problem by forcing cin to "catch up" to getline. Basically …
Based on how you are describing your problem I think you may be facing an irreducible problem. From what I understand from your post it seems that your problem can be boiled down to this: Find the subset of n objects from a given set with the highest value, given …
Hello. As a Software Engineer I admit a slight lack of knowledge with hardware. I am usually quite good with any hardware that is contained within the case, my issues lie in networking. Usually I fix my own computer problems, but now I have a couple networking problems that I …
In general when faced with such problems you should try to do it yourself first. Typically grabbing pencil and paper is a good start. Write out a number in some base and try to convert it to some other base. First try a full example, then try to convert a …
Hello. I was reading http://xkcd.com/287/ while bored and thus decided to write a program that would solve such np complete problems. Here is what I got: #include <iostream> #include <vector> using namespace std; template <typename T> T NPMenuProblem(T desired, vector<T> options, vector<T> &ret) { vector<T> save=ret; T remainder; T min=desired; …
Hello, I am making a program that deals with bitmap files and I want to try to load bitmap data manually. The issue is that I cannot find a good resource for exactly what bitmap files can contain. [Wikipedia](http://en.wikipedia.org/wiki/BMP_file_format) has a decent article, but it is missing some important information. …
I may be wrong, and I know I am not saying it all, but as I understand it the namespace in which cin/cout live (std::) is full of stuff... literally anything that is standard c++ should be in there (thats why they call it std, its short for standard, not …
I like my code compact, and consistent without too many files and well aligned code. I also gravitate to c-style code like this: MyGoodHeader.h: #ifndef MGH_H #define MGH_H ///@brief Puts the drawing cursor at a specific point in two dimensional space. /** This sets the raster position to the specified …
It isn't skipping it... I'll explain: When you created searchId you defined it as returning void, and taking an integer array (id[]) and a reference to an integer (idNum). Then you told the compiler that right now the function does nothing (that ; actually kinda means {}... kinda). Anyways, normally …
Your code is incomplete. All you do is read 1 high and 1 low value, then output them... there is no code for anything more. To input more than one value you will need a loop of some sort, and to calculate the average you will need another. Your code …
Ok, so occassionally as I write my code, a non-printing character is insterted... according to code::blocks this character is actually two characters (\302 and \206). I have done much searching to solve the problem, but a solution has eluded me. I tried using the windows console type command on a …
Basically, a linked list for a stack will only have one link, pointing to the next element. As such your stack will look something like this: First->Second->Third->NULL (where -> indicates that the value has a pointer to the value to the right) In terms of the "standard" linked list struct: …
I think this has to do with a disconnect between cin/cout token and line reads. As I understand it, when you cout<<"Text"; the console gets "Text" put into it and the cin read point goes to 5 (the position after "Text") but getline doesnt use this read point, so it …
The issue is that reverselist as you wrote it expects a reference to a pointer of a nodetype, but you passed it num#.head_ptr which is of type pointer which will be converted to a const reference to a pointer of a nodetype (since num1,num2 are declared const in the function …
Hello, I am working on an arbitrary precision arithmetic library. I already created a version that just stored numbers as "before decimal point [unsigned array]" and "after decimal point [unsigned array]". The issue is that it is both inefficient and incomplete. I would like to incorporate complex numbers into the …
Hello, I was partaking in the global game jam (where you have to try to make a game in 48 hours). I got my game pseudo-finished, but I cannot get it to render the scene properly. Here is the code related to the rendering: Code for opengl initialization: glClearColor(0.5f,0.5f,0.5f,1.0f); float …
Yeah, the problem is that ^ is not the exponent operator in c++. Rather a^b performs the bit xor operator on the two operands. As the bit xor operator requires two integer types to work (or even to make decent sense) it makes no sense to have it work on …
(-1)^k = 1 if k is even, -1 if k is odd so: for (i=1; i<=N; i++) { if (i%2==0)//if it is even { sum+=1.0/(i+1);//since i is your k, you just divide by i+1 } else { sum-=1.0/(i+1); } } The rest is simply multiplying, then taking the square root.
rand() does not have the range necessary. It only generates a random number between 0 and RAND_MAX (just output that number to see the necessary range). As such you have three options: 1) Write your own pseudo random number generator (wikipedia has some good articlos on them) 2) Download a …
Hello, I am using Code::Blocks, and recently any time I try to compile any program I get the errors "stray '\302' in program" and "stray '\206' in program" about every 20-30 lines. I know how to fix these (by deleting the non printing character(s) in the line in question) but …
Firstly, I notice a very obvious problem in your if-else-if statements in that you end with else Code Statement 1; Code Statement 2; Remembering that C++ doesn't care about whitespace you can rewrite that to be more clear on its function like this: else Code Statement 1; Code Statement 2; …
Line 113 of your header file does not match its declaration. You have an extraneous array parameter.
Hello, I was wondering how to make the windows explorer popups that many programs use. I want the one that browses files to either open or save a file rather than requiring the user to blindly type the filename.
The End.