I want a code of c code
which can take million integers as input,
sort them (bubble or quick or selection sort).
It should display time taken to sort first 10 integer, then for first 100 integer, then for 10000 and total.
Please help me soon I have very less time to complete my project.
Well then, you'd better hop-to-it and get writing then don't you?
There's countless examples of sorting code on the web. If you cant even be bothered to search for them, and instead ask to be spoon-fed,you're not going to enjoy programming much - it's an occupation that required copious amounts of research.
Also, you might wish to edit your question to remove your email address - you'll get email notifications if someone replies anyway - providing your email just provides opportunity for others to inconvenience you.
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
I am trying to get all available logical drive information using WMI services. If a partition is under extended partition, I am getting wrong startingOffset although getting correct startingoffset in case non extended partition.
The assert fails because the CWnd* does not point to an object that contains a valid Window handle. Something in your code has not been initiailised correctly, or you are calling Create from outside of a Window class. What class is Show_storage?
CMFCPropertyGridProperty* level1Group = new CMFCPropertyGridProperty(_T("Level1"), 0, TRUE );
CMFCPropertyGridProperty* subLevel1 = new CMFCPropertyGridProperty(_T("subLevel1"), _T("subLevel1"), _T("subLevel1") );
CMFCPropertyGridProperty* level2Group = new CMFCPropertyGridProperty(_T("Level2"), 0, TRUE );
CMFCPropertyGridProperty* subLevel21 = new CMFCPropertyGridProperty(_T("SubLevel2.1"), _T("SubLevel2.1"), _T("SubLevel2.1") );
CMFCPropertyGridProperty* subLevel22= new CMFCPropertyGridProperty(_T("SubLevel2.2"), _T("SubLevel2.2"), _T("SubLevel2.2") );
CMFCPropertyGridProperty* subLevel23 = new CMFCPropertyGridProperty(_T("SubLevel2.3"), _T("SubLevel2.3"), _T("SubLevel2.3") );
I tried inheriting my own CMFCPropertyGridProperty class and overwrite the OnDrawName but because of many protected members in the base class. (see CMFCPropertyGridProperty::OnDrawName in afxpropertygridctrl.cpp )
Now, I did overwrite the OnDrawName method, but removed lot of code that was in the base method that did not compile (access to protected members); but it seems to be OK.
As is well known when using switch (expression), thus:
"The expression must be of an integral type or of a class type for which there is an unambiguous conversion to integral type".
If the switch contains a number of case / 2 to 4 /, then there is no problem.
Well, if you say case is 30 pieces, then dostura to 29 in a row case, the compiler must make 29 comparisons.
Below is a one of the solutions to this problem.
And so the program as expression must transmit the index number to any array, containing the address points
transition operator goto.
Notes: Of course array must contain the called function.
Have a gander here[^]. Pay particular attention to #11.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
I'm developing a simple tracking game using two haptic devices as controllers.
Haptic rendering is executed in a high priority thread.
During the experiment, force experienced will depends on the position of each player, it's calculated as follows:
I have 100 trials of tracking tasks and I have to calculate the average interaction force during each trial. How it can be done? my issue is: this manipulation have to be done in a thread with execution rate of around 8KHz
Thank you!. I have already seen some implementation of moving average. But I'm not sure about how to implement for my application. Since it's in a thread which is executing at 8Khz, I'm wondering how to store forces trial by trial and to take avareage?
The fastest solution would be a ring buffer and a total sum variable (untested):
int items = 0;
int ndx = 0;
// May need floating point here when max. value * buffer_size >= INT_MAX
int sum = 0;
int get_av(int val)
if (items >= buffer_size)
sum -= buffer[ndx];
sum += val;
buffer[ndx] = val;
if (++ndx >= buffer_size)
ndx = 0;
return sum / items;
You are allocating 4 bytes (on 32 bit platform) instead of approximatively 60 bytes.
The following line is also incorrect:
Since you are Inside a function, the pointer is passed by value and a change inside the function has no effect outside of it. You need to have a pointer to a pointer to be able to update the pointer at the caller location.
You don't initialized new list to NULL so first insertion might fails because the pointer is garbage.
I am trying to run a Legacy MFC application in Debug buil(earlier it was always built in Release Build (with debug info)). While loading resource using LoadToolBar() funtion ::FindResource fails while it succeeds in the Relase build. Can any body help me with this.
When it comes to resources, it could be any number of things... if you make the call within a dll and not the main application, you have to make sure to have the resources of the main application loaded and not the dll's resources.
In any case, hard to tell without more info and some code.
3 users are connected to one pc using 3 usb keypads. A record is shown and each user have to input a number like 7.7 or 600 or 7.5 then they will press ENTER. Done.
So as an example problem: user2 starts to type 7 and user1 starts typing 5. the computer is already getting 75. You can see the problem.
I need a utility/code to isolate the input.
I have seen it in an auction software and also using xbox playing games.
In the auction software 3 black boxes are seen in the PC. Once a user starts the black box associated with that user, turn gray. Same as the other users. When all users have pressed ENTER, All boxes are revealed with the entries.
Until now we only had to enter one digit per box, so 3 keypads were no problem. The system right now have the 3 boxes in the screen.