|
Set the image path relative to the base path and if it still happens, try to add the "BASE HREF" statement to set this base path.
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I'm working on a MFC application. I want to have some kind of a key mapper. I want to be able to convert key codes to the keys name - if for example the user presses "backspace", "Backspace" is displayed in some edit field.
Is there any easier way to do this than to set up a gigant switch and/or STL map, or is there even a pre-defined map or something like that?
You don't want to do work more that you have to!
|
|
|
|
|
Gadjuka wrote:
gigant switch and/or STL map
A switch is hideous. A map is made for this sort of thing. How huge can it be, anyhow ? I've built much bigger maps than this.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In MSDN: There is GetKeyNameText.
|
|
|
|
|
That was exactly what I was looking for!
Thank you very much!
|
|
|
|
|
Could you tell me what books like Real World .NET Application ?
The book has some good application for learning.
Thanks in advance
|
|
|
|
|
How to use CByteArray to store large data into Oracle database.
|
|
|
|
|
dear friends,
I'd a problem. I want to instatite a template class like this
MaxHeap<Array<int>> m; I'm using vc++. Why it is so. The code is working if i'm changing code and using like MaxHeap<Array> m;Why it is so. How to solve this problem. Please help me in this aspect.
But compiler is giving errors like
Compiling...
heap.cpp
d:\cpppractice\sep3\heap.cpp(13) : error C2146: syntax error : missing ',' before identifier 'm'
d:\cpppractice\sep3\heap.cpp(13) : error C2065: 'm' : undeclared identifier
d:\cpppractice\sep3\heap.cpp(13) : error C2143: syntax error : missing '>' before ';'
Error executing cl.exe.
heap.obj - 3 error(s), 1 warning(s)
complete code is:
# include <iostream>
# include <Heap1.h>
using namespace std;
using namespace bhadram1;
int main()
{
int array[10]={20,12,35,15,10,80,30,17,2,1};
Array<int> a(array,10);
Array<int> a1(a);
MaxHeap<Array<int>> m;
//m.initilize(a,10,10);
//m.print();
return 0;
}
# include <iostream>
using namespace std;
namespace bhadram1
{
template<class T>
class Array
{
//friend ostream& operator<<(ostream& ostr,String& s);
protected:
int size;
T* data;
public:
Array()
{
size=1;
data=new T[1];
}
Array(int n)
{
size=n;
data=new T[size];
}
Array(int* a,int const s)
{
size=s;
data=new T[size];
for(int i=0;i<s;i++)
{
data[i]=*a++;
cout<<data[i]<<endl;
}
}
Array(Array<T>& a)
{
size=a.size;
//delete[] data;
data=new T[size];
for(int i=0;i<size;i++)
{
data[i]=a.data[i];
}
}
T& operator[](int i)
{
return data[i-1];
}
};
template<class T>
class MaxHeap
{
private:
int currentSize,maxSize;
public:
MaxHeap()
{
currentSize=0;
}
void initilize(T a,int size,int arraySize)
{
T heap(size);
for(int j=1;j<=10;j++)
{
heap[j]=a[j];
cout<<heap[j];
}
currentSize=size;
maxSize=arraySize;
for(int i=currentSize/2;i>=1;i--)
{
int y=heap[i];
cout<<"a "<<a[i]<<" y "<<y;
int c=2*(i);
cout<<"c "<<c<<" current "<<currentSize<<endl;
while(c<=currentSize)
{
cout<<"sub c "<<c<<endl;
if(c<currentSize && heap[c]<heap[c+1])
c++;
if(y>=heap[c])
break;
heap[c/2]=heap[c];
c*=2;
}
heap[c/2]=y;
}
for(i=1;i<=10;i++)
{
cout<<"final "<<heap[i]<<endl;
}
}
void print()
{
}
};
};
Thanking you,
yours sincerely,
bhadram
bhadram
|
|
|
|
|
>>MaxHeap<array<int>> m; I'm using vc++. Why it is so
Because you need to pust a space between >>
Example:
MaxHeap<array<int> > m;
It'll work if you put the space in. The space is required, because the compiler see this >> as operator >> (instead of template brackets).
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Hi,
I have a MDI project.
How can I exchange data from one Editcontrol to another editcontol. I open two instances of a view.
I change the text of the Editcontrol in one view.
Afterwards, I close the view. The changed text should appear to the second view in the Editcontrol.
Can you help me please?
Klef
|
|
|
|
|
Hi,
You may use the CDocument::UpdateAllView method.
This will call the OnUpdate method of all view instances which are currently displaying the same CDocument object.
Eric
"If it is not broken, do not fix it"
|
|
|
|
|
Hi,
Thank you for your answer.
Is there in the forum possibly an example which I could look at myself the thing times?
Best regards
|
|
|
|
|
I want to use VC++ *.lib into C# application. I know that I must compile the lib in to a dll. How can i do that? Any method and hits to me.
|
|
|
|
|
IMO, the easiest way is to create a DLL that exports functions that simply call the .LIB functions:
BOOL __stdcall fooFunc_DLL(int p)
{
return fooFunc_LIB(p);
}
that way, you don't have to change the .LIB functions, and the DLL is a simple one-step pass through.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I suggest you start reading here[^] in the MSDN about DLL's. In order to use your object library (the .lib file) as a DLL, you may need to create a DllMain function in a .C or .CPP source file, compile it, and link it to your .lib.
You will need to research further what it takes to use a DLL from C#; that's something I don't know about.
By the way: I don't know who the two boneheads were that rated your post a 1. I think your question is valid, asked politely, and in the correct forum. Good luck.
Software Zen: delete this;
|
|
|
|
|
Hi
I am using SQL Server for my database programming using CRecordset. but now i have to use Oracle. I am connecting to Oracle using ODBC. How to access tables from Oracle. Tables having BLOB datatype fields. how to access Oracle through VC++. Can u plz guide me.
Thanks in advance.
|
|
|
|
|
Hello,
You can use CDatabase and CRecordset classes for accessing the database and retrieving the records from Oracle. While passing any query when you mention the table name is sufficient, as the ODBC will be connecting to the whole of the database and tables are part of the database.
If the reply helps you, Don't forget to rate it.
|
|
|
|
|
the code below is weirld casue when the change is mutiple by 100(0.67 * 100)
it change to 66 please heplp me solve this
#include iostream
using namespace std
int bugger;
float change=0.67;
int moeny[6][2];
int cointo[6];
float cash;
bugger = (float)change * (float)100;
cout<< "change2: "<<bugger<<endl;
while(bugger !="0" &&="" cash="" if(bugger="">= 100 && money[0][1] !=0)
{
money[0][1]--;
bugger=bugger-100;
cointo[0]++;
cout<< "bugger: "<<bugger<<endl;
}
="" else="" if(bugger="">= 50 && money[1][1] !=0)
{
money[1][1]--;
bugger=bugger-50;
cointo[1]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 20 && money[2][1] !=0)
{
money[2][1]--;
bugger=bugger-20;
cointo[2]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 10 && money[3][1] !=0)
{
money[3][1]--;
bugger=bugger-10;
cointo[3]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 5 && money[4][1] !=0)
{
money[4][1]--;
bugger=bugger-5;
cointo[4]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 1 && money[5][1] !=0)
{
money[5][1]--;
bugger=bugger-1;
cointo[5]++;
cout<< "change: "<
|
|
|
|
|
'int moeny[6][2]' (money after) is not initialized ...
'int cointo[6]' is not initialized ...
'float cash' is not initialized ...
before using.
|
|
|
|
|
this is only a part of the code the problem wit this code is that when then chagne is store in the bugger it always change example((bugger)6.7 = (change)6.6) it always change to a diferant number so can please tell me why please
|
|
|
|
|
You get this problem because of the way floating point numbers are represented, and the way types are converted.
When you convert a float to an integer, for example in the statement:
bugger = (float)change * (float)100;
the float is truncated (i.e. the fractional part is discarded.)
When you multiply two floats (eg 0.67 by 100.0), the answer will not be exactly an integer (eg. 67) - it will be slightly more or slightly less. Since the result you get after truncating is 66, this implies the float representation is less than 67, i.e. 66.9999 . . . Truncating 66.99999 gives 66.
The solution - add some small number to the result before truncating, as below
bugger = (float)change * (float)100 + 0.0001;
|
|
|
|
|
|
I had been taught not to use goto or switch. However a lot of professional code uses both.
Is the switch statement any faster than a lot of if anf else if's? In other words, is switch the same thing as a lot of if else ifs from a machine code point of view?
|
|
|
|
|
I agree it's a good idea to avoid goto, but in my opinion there are correct applications for switches and I would not be surprised to see them in professional code.
I doubt there is much difference between if's and switches in terms of speed. I think the main issue is clarity. The switch is just easier to read if there are a lot of states to be tested.
Best Regards
Cliff
-- modified at 5:11 Sunday 4th September, 2005
|
|
|
|
|
With today's compilers, switches and ifs can perform about the same. You will often find that a compiler will convert a switch statement to a series of ifs and maybe even visa-versa.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|