|
It is a reasonable guess that pTemp->m_hWnd is not a valid Window handle. How that came about is impossible to guess. You need to use your debugger to gather more diagnostic information.
Also there is some information at Debug Assertion in occcont.cpp Line: 926[^] which may help. But either way this looks to be a Microsoft problem, so you should report it (with full details) to them.
|
|
|
|
|
Good Morning everybody.
I'm developing a program in C++.
It is supposed that the program has to read from excel and write the data in a .txt file. It has to do that during 10 minutes, and after that save the .txt and start doing it again.
How can I do the timer?
May you help me please?
The program I write is this one: (Not sure if is correct)
#include
#include
#include
#include
#include
#include
using namespace std;
struct vehiculo
{
char VIN[8]
char hora[19]
};
int main()
vehiculo cocheentrante
{
File *F;
File *G;
F = fopen("C:\Users\Ford\Usuarios\Cristales\VINES.csv", "rt");
if (F == NULL)
{
cout << "No se pudo abrir el archivo de entrada. \n";
}
else
{
cout << "El archivo se abrio correctamente. \n";
}
G = fopen("dd_mm_aaaa__hh_mm_ss.txt","w");
if((G = fopen("dd_mm_aaaa__hh_mm_ss.txt","w"))!= NULL)
{
while(!feof(F))
{
fgets(VIN,8,F);
fgets(hora,19,F);
fprintf(G, "%s %s", &VIN, &hora);
}
}
fclose(G);
fclose(F);
}
modified 17-Jun-20 5:31am.
|
|
|
|
|
|
How about create your program to just do the file I/O, and then let windows handle the timer/scheduling part?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
#include<stdio.h>
void main()
{
int t,j;
scanf("%d",&t);
for(j=0;j<t;j++)
{ int num;
scanf("%d",&num);
while(num!=1)
{if(num%2==0)
num=num/2;
else
num=(3*num+1);
}
if(num==1)printf("YES\n");
else printf("NO\n");
}
}
This is my small version of given problem , the constraint is very big please give new code which satisfy the constraint mentioned in the link
<a href=""></a><code><a href=""></a><pre><pre lang="text"></pre></pre></code><a href="https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/conject-it/description/">Conject-It ! | Basics of Input/Output & Basic Programming Practice Problems | HackerEarth</a>[<a href="https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/conject-it/description/" target="_blank" title="New Window">^</a>]
|
|
|
|
|
No.
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You should find another (algorithmic) approach. Dealing with such huge numbers (order of 2333) is far beyond the possibilities of the standard C/C++ integer types.
|
|
|
|
|
Just an observation...
The only condition that will exit the while() loop is when num is equal to 1 . The if() test after that will always print YES.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
A well known conjecture: Collatz conjecture - Wikipedia[^] (with many other names too).
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Differentiate between: (elaborate with diagrams)
a. const int *ptr;
b. int const *ptr;
|
|
|
|
|
|
|
So lazy you couldn't even put your homework into your own words? Just google it. But first, refer to the material your professor provided in class.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
It sure may be homework, but then again: If different phrasings are both accepted by the compiler, it is legitimate to ask if they are identical, even if it is not homework .
If "const int *ptr" is identical to "int const *ptr", is it then identical to "int *const ptr" as well? If you can shift the "const" keyword one position, why not two? There are several cases (in various languages) of modifiers that can be written in any order (when there are more than one). Knowing when order/position is significant and when it isn't (and which orders/positions are illegal) can be quite confusing until you have built expertise in the language!
|
|
|
|
|
They are equivalent. The int value is constant, cannot be modified. Now that you decalre a pointer to this type, this pointer can be set to any constant int value, but the pointer itself may be moved around freely among several constant integer values.
The difference comes when you move 'const' to the right of the asterisk:
int *const ptr = &xxx;
Now the xxx value may change, but ptr will always point to xxx. You are not allowed to move ptr to &yyy. You can consider *ptr as another way of writing xxx. Or ptr is another way of writing &xxx. You can't move xxx to refer to another variable either, so *ptr and xxx, or ptr and &xxx work the same way. You rarely need constant pointers; the address it is initialized with will serve the same purpose. But if the address expression is complex, and it is used many times, setting up a constant pointer may save both typing and improve readability (as long as a more descriptive name than "ptr" is chosen ).
|
|
|
|
|
Member 7989122 wrote: They are equivalent. And nicely confusing.
|
|
|
|
|
Context: I have some applications that were originally written for Xp. This is important, because we're running into issues with security changes from Xp -> Windows 10. Some of the code in the application makes assumptions for Xp that are evil for Windows 10. So, I'm migrating these apps from VS 2008 to VS 2017 and maybe later.
So, firing up VS2017 and attempting to build some demo projects, I'm prompted to re-target the application. Visual Studio offers me 3 different SDKs. I've dealt with mfc over the years, but the mfc dlls seem to be always included everywhere.
Should I be concerned about which sdk I build for?
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
I have done this when moving from VS2015 to 2017, and recently when moving to 2019. I always choose the one with the highest number. Alternatively, create a quick minimal Windows app in VS 2017 and check its properties to see which version it sets as default.
|
|
|
|
|
You might want to consider moving directly to VS2019. Differences are quite small but one important factor that made me upgrade is that, in VS2019, you can set the target platform to "10.0 (latest installed version)". That saves you a lot of headaches when changing development machines or when you have different developers.
Again from my experience, you can safely assume that a Windows 10 machine will have the runtime already installed.
Mircea
|
|
|
|
|
Quote: you can safely assume that a Windows 10 machine will have the runtime already installed.
lol, did you really just say that? In fact, this is where I was going with my concern. A couple of these apps have very small user bases, but one of them happens to be my boss. For some reason, he seems cursed when trying to run these applications, but I do understand what you are saying.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
|
Hello guys !
I just need a little help with this code, it's a recursion method to solve the 0-1 knapsack problem, but I want someone to re-write the code in a normal form (For loops, while loops, etc...) for me, here's the code:
#include <iostream>
#include <climits>
using namespace std;
int knapSack(int v[], int w[], int n, int W)
{
if (W < 0)
return INT_MIN;
if (n < 0 || W == 0)
return 0;
int include = v[n] + knapSack(v, w, n - 1, W - w[n]);
int exclude = knapSack(v, w, n - 1, W);
return max (include, exclude);
}
int main()
{
int n;
cout<<"Enter number of items:";
cin>n;
for (int i=0; i<n; i++) {
cout<<"Enter the value of item number "<< i <<"\n";
cin>>v[i];
cout<<"Enter the weight of item number "<< i <<"\n";
cin>>w[i];
}
int W;
cout<<"Enter the capacity of knapsack"<<"\n";
cin>>W;
cout << "Knapsack value is " << knapSack(v, w, n - 1, W);
return 0;
}
And I really appreciate all of your help
|
|
|
|
|
iNoor72 wrote: but I want someone to re-write the code in a normal form (For loops, while loops, etc...) for me, here's the code: It doesn't work that way here. You would be better off asking specific questions, with as much detail as possible, and posting the appropriate code.
"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 guess it's basically re-writing the code from this current way (the recursion method) to a for-loop way, I've nothing more to say tbh
If you can help me re-writing this code because I'm unfortunately not that good with programming at the moment, I'm still learning some basics.
|
|
|
|
|
iNoor72 wrote: I'm still learning some basics. And you'll be stuck there by continuing with this paradigm. Do the work yourself. Only ask for help after you have exhausted all other resources!
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|