We have a situation we want to do a sort of weighted average of two values w1 & w2, based on how far two other values v1 & v2 are away from zero... for example:
If v1 is zero, it doesn't get weighted at all so we return w2
If v2 is zero, it doesn't get weighted at all so we return w1
If both values are equally far from zero, we do a me...
Hi All,
I am trying to suspend my system using a c++ program using SetSuspendState method but I am facing issue during linking.
I am using g++-4 (GCC) 4.3.4 20090804 (release) 1 compiler on Windows 7 OS (64bit).
The code I have written is
#include <iostream>
#include "windows.h"
#include "powrprof.h"
using namespace std;
int main()...
I can't seem to update my configuration file in c:\ProgramData\appname\config.ini. I keep getting an access denied error. Seems the ini code fails to be able to delete the existing .ini file when trying to update it with the new file. Funny thing is that I have other programs I've written that share the same code but don't have this prob...
Hi,
I have a compile problem I can't figure out for OpenCV2.1 in c++.
Here is a simple test code I am trying to compile:
#include <iostream>
#include "cv.h"
using namespace std;
int main() {
cout << "Hello World" << endl; // prints !!!Hello World!!!
cv::Mat mtx;
return 0;
}
I a compile error with an undefined referenc...
In my C++ project, I have a class App, and a class Window. Class App has a parameter: vector<Window*>* window;.
In App's constructor, it is able to use and push_back a Window* onto this vector fine, but in my onMessage() method, which is called by the WndProc() (I'm using winapi), it gives me an runtime error when I try to use the vecto...
This is sort of a strange question, but oh well.
I feel like writing a (rich) text editor mainly to be used for note-taking, in either C or C++, using most probably GTK or Qt for the UI.
The problem is that I can't really decide what to use. I know both C and C++, C a little better. I've never used Qt but I'm completely fine with learn...
I need a little help if someone's got a minute.
I've written a web server using IO completion ports, but I am having some trouble sending out large files. Web pages seem to load fine, but during large file transfers, WSASend() fails after a few minutes with error "The specified network name is no longer available."
Right now, my server ...
I'm writing a simple loop to make sure my input is a valid binary. Ex: I want to throw an error when any number higher than one is user input. I know I need to check against the ASCII numbers. What is going on here? I should not be getting an error when I input binary. Any thoughts?
for (int i=0;i<size;i++)
{
printf("%i is string su...
Sometimes I need to perform a rebuild of my project but I don't want the pre-compiled headers to be recompiled every time I do that - sort of defeats the purpose, at least in this case. Is there any way to get Visual Studio to rebuild without recompiling the PCH and compile the PCH as needed (if the rarely changed headers change)
...
What exactly is the point of having multiple source files in c++? Sorry if this incredibly simple.
...
Possible Duplicates:
List of freely available programming books
Ansi C & C++ free e-book source for download
Free C programming ebook for beginner students?
i would like where i could get the best pdf's for c/c++ tutorial
...
Does the following code invoke undefined behaviour? As far as I know we should always use new to create user defined objects dynamically because new in addition to malloc calls the constructor too.
#include <cstdio>
#include <cstdlib>
struct om
{
int a;
void fun()
{
a=10;b=10;
}
private : int b;
} s1; // st...
Hello,
I'm trying to learn "big three" in C++.. I managed to do very simple program for "big three".. but I'm not sure how to use the object pointer.. The following is my first attempt.
I have a doubt when I was writing this...
Questions
Is this the correct way to implement the default constructor? I'm not sure whether I need to h...
Possible Duplicate:
What are the thread limitations when working on Linux compared to processes for network/IO-bound apps?
What is meant by context switches in threads or processes ? Also which is better : Threads or Processes ? I mean which is more space efficient and which is more time efficient ?
...
I know there are plenty of tutorials about integrating C++ into Java, but whats about the other way around, a Bridge from Java to C++?
The reason i'm asking this is Android.
Every C++ developer who wanted to write applications for the android noticed at some point that there is no serious (mature) C++ api for android (infact, android i...
Hello,
Having programmed microcontrollers before and being interested in trying my hand at building an NES emulator at some point, I was really wondering how interrupts are implemented in C++?
How, for example, does a program know how to react when I speak into my mic or move my mouse? Is it constantly polling these ports?
When emulat...
Is the passing by reference of a private variable in a class to be directly changed outside that class acceptable practice? Or is this something that the compiler 'should' pick up and prevent?
Example:
//-------------------------------------------
class Others
{
public:
Others() {};
void ChangeIt(string &str) { str = "Changed by Othe...
I need std::locale class, that defines ru_RU.CP1251 standart facets
(ctype, collate, numeric, …). I feel sombody have released all main
locales. Is there a libraries, or source files storage where I can
download it and just include in my project like this, for example:
#include <some_lib\ru_locale.hpp> // library
#include <locale>
#inc...
I am confused about the strange syntax provided by C++ function templates and class templates. Take a quick look at the code below:
#include <iostream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <vector>
using namespace std;
template <class op1,class op2>
class compose_fg_x_t : public unary_function<typena...
Hi. I has been a C++ and Python developer for a looong time, and after this many years the place I feel most comfortable for developing is the old good gvim and the command line. I was wondering if there is some sort of tool for setting up projects quickly. Something like generating a bunch of files where a few things can change their va...