|
i have to sort an arry using this code, but the template won't accept the parameters. can anyone help me?
/////////////////////////////////////////////////////////
#include <algorithm>
#include <iostream>
#include <string>
#include "InsertionSort.h"
#include "ShellSort.h"
using namespace std;
int main()
{
int num[] = { 5759, 6865, 2532, 8783, 7064, 531, 7351, 3761,
8838, 7290, 5058, 3361, 4912, 7790, 9691, 5330,
892, 1134, 4412, 5187, 1394, 837, 7615, 6087,
2336, 4052, 6238, 4470, 9675, 4859, 6156, 6394,
2885, 584, 8138, 729, 9752, 2805, 3966, 5206,
6374, 5727, 8144, 3683, 7830, 947, 2132, 384,
6726, 2023, 8512, 5839, 2091, 783, 531, 2403 };
string name[] = { "Tracy", "Zachary", "Louis", "Jakub",
"Katerina", "Anthony", "Carl", "Robert",
"Stephen", "Cedric", "Anthony", "Bernard",
"Michael", "Bart", "Esosa", "Eric", "Jose",
"Dominic", "Katarzyna", "Inna", "Catheri",
"Kirill", "Sean", "Igor", "Jose", "David" };
const int numSize = sizeof(num) / sizeof(*num),
nameSize = sizeof(name) / sizeof(*name);
int num1[numSize], num2[numSize];
string name1[nameSize], name2[nameSize];
copy(num, num + numSize, num1);
copy(num, num + numSize, num2);
copy(name, name + nameSize, name1);
copy(name, name + nameSize, name2);
sort(num, num + numSize);
sort(name, name + nameSize);
insertionSort(num1, num1 + numSize);
insertionSort(name1, name1 + nameSize);
shellSort(num2, num2 + numSize);
shellSort(name2, name2 + nameSize);
cout << (equal(num, num + numSize, num1) &&
equal(name, name + nameSize, name1) ?
"Congratulation! Your insertion sort works." :
"Your insertion sort doesn't work. Try again.") << endl;
cout << (equal(num, num + numSize, num2) &&
equal(name, name + nameSize, name2) ?
"Congratulation! Your Shell sort works." :
"Your Shell sort doesn't work. Try again.") << endl;
return 0;
}
//////////////////////////////////////////////////////
template<typename t="">
void insertionSort(T a[], T b)
{
for (int g=1; g<b;g++)
{
="" int="" j,temp1;
="" temp1="a[g];
" for="" (j="g;j">0 && temp1< a[j-1];j--)
a[j]=a[j-1];
a[j]=temp1;
}
}
/////////////////////////////////////////////////
template<typename t="">
void shellSort(T a[], T b[]){
int i, j, temp, gap;
for (gap=b/2;gap>0;gap=gap==2?1 : (int)(gap/2)){
for (i=gap;i<b;i++) {
=""
="" temp="a[i];
" j="i;
" for="" (;j="">=gap&&temp
|
|
|
|
|
Can anyone send me the file unicows.lib via email please.
I still run windows 95 on my computer so am unable to download the new Platform SDK. Or has anybody done it before.
Thank you
|
|
|
|
|
Hi.
I read that there is a way to display addition attributes in Active directory on the context menu of Microsoft Window Shell and Active Directory administrative adds-in. Does anyone has a sample code for this or know where it is available?
Thank you.
|
|
|
|
|
Yes I have code of my own and some that I wrote for MS. The MS code was given out on the DevDays99 content CD's Track 1. What would you like this sample code to specifically do? I'll see how I can accomodate.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
Anyone have any code to map points in a source rectangle to points in an output quadrilateral? This is essentially a perspective transform. I'm only interested in 2D (not 3D).
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Hello.
I was wondering if there is any easy function I could call to input key commands directly into the keyboard buffer. One that I could use for a windows dialog application just like I was typing them in with the keyboard.
Please help!
|
|
|
|
|
|
I was wondering if there is any easy function for controlling the mouse? One that I could use in a windows (dialog) application.
I need the source code for setting the x,y position of the mouse pointer in windows as well as simulation mouse button clicks.
Preferably one that doesn't require 5 pages of strange word in random order, 7 years of university in programming and hours searching the net for lost (if ever existing) header files... Just one I can call like this:
set_mouse_pos(x,y);
and
mouse_button(1);
I can find code examples of how to read mouse anywhere but when it comes to simulation mouse movements, there’s nothing. Please help.
|
|
|
|
|
take a look at SendInput
MSDN says this about SendInput :-
"The SendInput function synthesizes keystrokes, mouse motions, and button clicks."
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Dir forum,
I want to delete some files in system folder likes "c:\\windows\\temporary internet files\\*.*"
But when I use some code like this, it don't run well.
SHFILEOPSTRUCT sh;
sh.hwnd = GetSafeHwnd();
sh.wFunc = FO_DELETE;
sh.pFrom = "c:\\windows\\temporary internet files\0";
sh.pTo = NULL;
sh.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
sh.hNameMappings = 0;
sh.lpszProgressTitle = NULL;
SHFileOperation (&sh);
Any ideas???
Please help me!
Thank you very much!
|
|
|
|
|
Hi, i need some help with detecting when a CD is inserted or ejected from a drive. I've tried to override get the message handler...
afx_msg BOOL CWnd::OnDeviceChange( UINT nEventType, DWORD dwData );
but it doesn't seem to be called? The docs say that the WM_DEVICECHANGED message is sent to all top level windows? so shouldn't all the apps get this message.
If anyone has any code for this it would be really helpful
Thanks.
Jared Allen.
|
|
|
|
|
Where can get a copy of source code of MPEG2/MPEG4 codec for windows and free of fee?If they are there,please tell me the URL or links.thank you.
Scratch
|
|
|
|
|
I like to write a program to delete some special folder. I try this code but it generate error : "Can not delete file: file system error (1026)".
SHFILEOPSTRUCT sh;
sh.hwnd = GetSafeHwnd();
sh.wFunc = FO_DELETE;
sh.pFrom = "c:\\windows\\temporary internet files\0";
sh.pTo = NULL;
sh.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
sh.hNameMappings = 0;
sh.lpszProgressTitle = NULL;
SHFileOperation (&sh);
please help me!
Thank you very much!
BUNG
|
|
|
|
|
Hi everybody.
I have to capture Dial-In connections to a server,
Can every body give me a sample code in VC++?
Help me please,
Regards.
|
|
|
|
|
I'm looking for some code that will manage the display of a storyboard
found in most digital film editors like Adobe Premiere, Macromedia Director,
ULead VideoStudio, etc. Anyone seen anything out there?
|
|
|
|
|
Thanks give some code to me.
Mail to : hellopk@163.com
|
|
|
|
|
how to reset the autonumber id when deleting records in a table......meaning how to have the id starting at 1 again
|
|
|
|
|
In Access, first delete the rows, then switch to design mode, change the datatype of the autonumber field to whatever, save the table. Change back and save again!. This can only be done on an empty table (I think), and I am not sure you can do it externally. If it is possible you would need to drop and then create the table using SQL syntax.
Consultant, system/web developer.
IMS Consulting AB, Sweden
|
|
|
|
|
Another way to do it is after deleting the rows compact the database.
Best regards,
Mark
www.mjsoft.co.uk
|
|
|
|
|
I'm looking for code samples for the Navigate2 function. Can anyone point me in the right direction?
|
|
|
|
|
Have you tried the following?
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/WebBrowser.asp
|
|
|
|
|
Hi there!
I'm looking for the way for the hands off install of the new printer driver on multiple workstations. I've tried to do it myself according to MSDN (AddPrinterDriver, AddPrinter, ...) with no success.
I don't want to invent the wheel any more, so I'll be very thankful for any trick, tip, link, etc. concerning:
1. Ready to use utility for this purpose (if any exists).
2. Article with good explanation of the driver installation process.
3. Tools for INF file processing/interpreting, especially INF file for printer driver.
Thanks in advance.
Regards,
Gennady
|
|
|
|
|
Hi!
Does anybody know where it is possible to obtain a free C++ source code for BCD or String Arithmetic (the last one is even better for me). The problem is I'm developing some Banking SW, so I can't use a floating point arithmetic in it, because it is prohibited by the country law. The only solution I know at the moment is to use the RogueWave RWDecimal<> template class. But the RW library is huge and imho ugly, I don't want to be tied to it. In addition, I need not so much functionality: only '+', '-', '*', and probably '/' operation... Could you help?
PS: Of course, it is possible to start writing the necessary class from scratch, but better is to take somebody's code and adjust it for my needs.
Best Regards,
Dmitry Leonov
|
|
|
|
|
Hi there,
If you have some source code to lock some key
in the keyboard, F1 .. F12 and Ctrl and Alt and Shift,
please send it to me!
Thank you very much!
|
|
|
|
|
I have searched this forum but havent come up with any useful results. I simply want to be able to read the input from a bitmap file, nothing fancy, I dont want to display bitmaps, just be able to access the value of a pixel at (x,y).
Any ideas/ places I can learn more about this/ code I can use?
Any help is appreciated...
cbb@andrew.cmu.edu
Cassidy
|
|
|
|
|