For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Airport is divided to many Runways. Each runway has a mixed fixed delay amount of
time to keep a plane on runway. If airplane delay time > runway delay time than airplane
needs to take out from a runway, then it is considered as missed and starts from again
from a runway. You need to find out the minimum total delay for particular input. First
input line is number of runways. Second input line is delay of each runway.
Third input line is capacity of each runway to accommodate planes. Forth input line is
total number of planes. Fifth input line is maximum delay an airplane can afford. If it
exceed the runway delay time it is miss and it needs to start from again from a runway.
You need to show how you managed the runways as output as well.
Examples:(All are from user input)
2 2 3 5 7
2 2 2 2 2
1 1 1 1 2 2 3 3
calculetion:(For another Example)
2 2 3 5 7 (runways delay times)
1 1 1 5 3 (Air planes Delay times are less or equal
1 2 2 0 0 than runways delay)
1sec -0 0 0 4 2
1sec -0 1 1 3 1
1sec -0 0 0 2 0
1sec -0 0 0 1 0
1sec -0 0 0 0 0
When you posted this yesterday in QA: How to solve this problem[^]
You posted it together with two very different code fragments "you wrote" but couldn't get working, and were encouraged to use the debugger to fix them.
Now, you're posting the question again with no code and asking for an algorithm "to solve it".
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.
And please, don't tell us you "wrote the code" because it's pretty clear from yesterday's post that you found something on the internet and hoped it would magically meet all your homework criteria...
Sent from my Amstrad PC 1640 Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
- where are the planes at the start: somewhere at the airport, at a runway, or in the air?
- what are the times when planes are scheduled to arrive or take off? If not times, what is the order? If not order, is there any other restriction about the sequence?
- what does delay(?) time mean for a plane? Is it the maximum time it can wait at the airport, or remain in the air? If so, when does the time start counting? Or does that time only start ticking when on a runway?
- what does delay(?) time mean for a runway? What is it's effect? When does it start?
- what do you mean by runway capacity? Typically I'd say the capacity of any runway is exactly 1, as there can't be two planes on the same runway at the same time! But clearly you mean something else. Explain!
- the goal is to optimize a time for the airport - which time is that?
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
I need to multiply integer value with a factor and want to do an overflow check with INT_MAX, INT_MIN for this.
Integer contains 4 bytes on my machine an this is the max variable-size.
I need to do this check for signed integer and unsigned integer. Only integer math/variables allowed.
The factor always comes as fraction with a nominator and denominator. The denominator always is 10
Factor might be greater 1 or less than 1
So for example fraction is 25/10, varible a is signed integer
a = (a * 25)/10 -> may cause overflow, because (a * 25) can be > INT_MAX ( or < INT_MIN )
if (a > (INT_MAX * 10)/25 -> not possible because of overflow, INT_MAX is the maximum number the compiler can store.
if (a > INT_MAX * (10/25) -> not possible because 10/25 is 0.4 which will be 0 in integer math.
So any idea how to solve my problem?
Thanks for any hint!
It will take more effort and cpu cycles to pick off the overflow than simply move it to next size up integer, do the mult on a that type and look at the result for overflow
So for 16 bit int and 32bit long as an example
long b = a;
if (b & 0x7FFF0000 != 0)
// error result in b is larger than an int
a = (int) b;
If you want to do it proper anal uses standard ints
int16_t a = ????;
int32_t b = a;
if (b & 0x7FFF0000 != 0)
// error result in b is larger than an int
a = (int16_t) b;
I linked only part of the /lib folder , my mistake.
Still like to know if my original question - linking to network resource is feasible.
This is basically result of my inability to ".configure" for non - native architecture.
The "configure" kept asking for dependency after dependency.
So I ended up running .configure on required architecture.
After a detour I am back to tying to implement / crosscompile C++ code.
I can option a prefix for desired architecture , but still having an issue linking to specific desired architecture libraries.
I was unable to use ".configure " to create correct foreign architecture library on "local" architecture.
I did a hack by copying an entire "foreign" folder to local device and was partially successful linking to it.
Still missing some library and could do same hack.
Is there a more "elegant" way to accomplish that?
Here is what is still failing to link correctly.
Sorry for the mess.
System.Windows.Markup.XamlParseException: ''The invocation of the constructor on type 'CommonXFS.Interface.Utility.MainWindow' that matches the specified binding constraints threw an exception.' Line number '5' and line position '9'.'
FileNotFoundException: Could not load file or assembly 'Interop.NXCameraXLib.1.0, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
IS there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK ,IDCACEL or IDABORT I would like to have 3 radio buttons specifying 3 choice and return the value of one of those to DoModal
Is there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK?
You would need to call the EndDialog function with the second argument set to the ID of your radio button. If you are not using Windows API and are using MFC instead... you would call CDialog::EndDialog
My DoModal is being called from
My CMainFrame once returning to DoModal via EndDialog the Dialog box is destroyed but the class/object is still around ( I created the modal Dialog on the stack ) so the data in the class is still available until I exit the CMainFrame Routine
Also the only way to have a bad return code from UpdateData is to call pDx->fail which has the side effect of an exception which I would have to delete. if everything is okay I just call EnDialog notifying the CMainFrame which called DoModal of my selection
Also the only way to have a bad return code from UpdateData is to call pDx->fail which has the side effect of an exception which I would have to delete. if everything is okay I just call EndDialog notifying the CMainFrame which called DoModal of my selection
OK, let me know if you have any problems here. But from what you've described it sounds like the desired outcome.
Last Visit: 16-Jul-19 8:46 Last Update: 16-Jul-19 8:46