I have the following code
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <stdint.h>
using namespace std;
int main(){
int x;
cin>>x;
uint32_t Ex;
Ex=(x<<1)>>24;
cout<<Ex<<endl;
return 0;
}
but it gives 0 for any value of x?
My task is the following:
Computation of the biased exponent Ex of...
In my project I use the std::queue class. I would like to know what happen if I do the following.
Get a a pointer of a element inside the queue (note: a pointer and not a iterator).
I make modification in the queue like push and pop in the queue (pop element which is not the pointed by the previous pointer)
Does my pointer still poin...
Possible Duplicates:
list of c++ tricks with names
What C++ idioms should C++ programmers use?
After reading books like C++ Primer, Effective C++ and TC++PL I want to learn some important design patterns.
So, what are the famous design patterns that every C++ programmer should know?
...
Hello,
I was wondering what the "best" way to verify the structure of my database is with SQLite in Qt / C++. I'm using SQLite so there is a file which contains my database, and I want to make sure that, when launching the program, the database is structured the way it should be- i.e., it has X tables each with their own Y columns, app...
Hello,
Is it possible to show a video that is playing onto an existing application?
Application A is running.
Get Video A and place it on top of Application A and then play it.
Thanks! Cheers!
...
I want to provide a member function for the "comp" parameter of an STL algorithm like lower_bound( ..., Compare comp ). The comp() function accesses a non-static member field so it must itself be a non-static member but the type of a non-static member function pointer is different from that of an ordinary function pointer.
What is the ...
am trying to understand pattern used in ublas.
pattern is such:
struct vector : vector_expression<vector>
where vector_expression is like this:
template<class E>
class vector_expression {
...
// no constructor or E pointer/reference in class
//
const E &operator () () const {
return *static_cast<const E*>(this);
}
complete so...
Hi,
Below code crash in VS 2010 when you compile with following flag and if you add /GF- or remove the opimization flag they don't crash. The crash occur at assembly code which translate 'if( path[i] == '/' )'. I like to understand the optimization that compiler does here and lead to crash. Looking forward for some pointers.
-Karthik
...
I'm trying to compile (make) a game source and it seems that my gRace.cpp file is being excluded or something because it keeps returning undefined reference errors for all my gRace class methods.
libtron.a(libtron_a-gGame.o): In function `gGame::StateUpdate()':
gGame.cpp:(.text+0x99e9): undefined reference to `gRace::Reset()'
libtron.a(...
I just fired up totalview on my "hello world" application (c++) and i only get to view the assembly code.
Is there any settings/flags i need to set to view the source code? Menubar->View->Source As->Source does not work for me.
the application im trying to debug is just a cout << "Hello World" application, just to get the debugger up a...
how to arrange dialogs programmatically in MFC in cascade format, other than simply using SetWindowPos based upon the position of the previous displayed window.
The Dialog position is to be loaded from the registry(in my app) so we use
SetWindowPos(NULL,x,y,cx,cy,SWP_NOZORDER); for the dialog , Ater then if we use CascadeWindows func...
I have been trying to make a StringTable class that holds a simple unordered_map<string, string>, and has the array index operator '[]' overloaded to work for accessing the map; however, the compiler will tell me that I have yet to define the overloaded operator when I try to use it. My code is as follows:
CStringTable.h
#include <stri...
hey, I have been given a problem, I basically have been given a piece of grid paper of arbitary size and have to develop a distance matrix using only the coordinates for each of the grid points on the page.
I'm thinking the best approach would be something like the Floyd-Warshall or Djikstra algorithms for shortest path pair, but don'...
We have a class example and I just don't get it. I don't quite understand how the operator() works in this case, and everything starting with sort. I looked at the output after running the program, and I don't see how those values are obtained.
sort indices array: 2 8 10 4 1 7 5 3 0 9 6 11
replay numbers array: 37 33 29 36 32 35 39 ...
Hi,
I'm having a std::vector with elements of some class ClassA. Additionally I want to create an index using a std::map<key,ClassA*> which maps some key value to pointers to elements contained in the vector.
Is there any guarantee that these pointers remain valid (and point to the same object) when elements are added at the end of the...
Possible Duplicate:
In a C function declaration, what does as the last parameter do?
What does this mean ,...); it is written at the end of a function in a code i am debuging.
like this void abc( int a, int b, ...);
...
I want to convert LPTSTR to string or char * to be able to write it to file using ofstream.
Any Ideas?
...
The output of the following function is "int *", which means the formal parameter is converted to a integer pointer. Is there any necessary reason for this design? Why can't we reserve the array type?
// the output is "int *"
#include<typeinfo>
void Func(int ar[5])
{
printf("%s\n", typeid(ar).name();
}
int main()
{
int ar[5];
Func...
Hi Guys,
in my project I'm making use of Eigen C++ library for linear algebra and ONLY when I turn on the vectorization flags (mfpu=neon -mfloat-abi=softfp) for ARM NEON, I get compiler errors. I'm not able to understand whats going wrong. Do I need to enable any preprocessor directives for ARM NEON in the Eigen Library?
main.c
#inc...
Hi,
I have a vector of doubles and I need to create another array which is a cumulative sum of the elements of the first. For example;
vector<double> Array(10,1);
vector<double> Sum(10);
Sum[0] = Array[0];
for(unsigned int i=1; i<Array.size(); i++)
Sum[i] = Sum[i-1] + Array[i];
Is there an in-built function that will ...