[Solved] Can someone help me to do this exercise [closed]

Used this code to obtain that output #include <stdio.h> #include <string.h> int main(void) { char text[1024]; int biggest = 0, newBiggest = 0, stopCondition = 0, phrase = 0; puts(“Enter text, end with #”); do { scanf(” %[^\n]s”, text); for(int i = 0; i < strlen(text); i++) { if (text[i] == ‘#’) { stopCondition = … Read more

[Solved] Monopoly Implementing Rules

Seems like your squares ought to consist of a type hierarchy. Square Card-Draw Chance Community Chest Tax/GO Jail Ownable Utility Railroad Colored All of these will have a polymorphic method virtual void VisitFrom(int diceRoll, Player activePlayer); For example, Utility’s implementation might be. virtual void VisitFrom(int diceRoll, Player activePlayer) { if (owner == Bank) activePlayer.offerProperty(this, 150); … Read more

[Solved] An awful lot of compiler errors [closed]

Presumably, the error message points you to this line for (index=0, index<10, index=index+1) You’ve written , where you meant ; Once you’ve fixed that, the first error message will probably point you at or near switch (grades[index]); where you’ve got a rogue ; Then it will point you at the scrambled if…else formatting in set_units, … Read more

[Solved] Need help to understand how this part of the code works

I assume it is this part of the line that is confusing: ((1 << collision.gameObject.layer) & groundLayerMask) You could try to read up in “bit fields”, first google hit is: https://en.wikipedia.org/wiki/Bit_field What’s happening here is that “groundLayerMask” is what its name implies, a binary mask which specifies zero, one or any combination of 32 possible … Read more

[Solved] Why the brainfuck interpreter in C may not work when executing a program with loops?

‘]’ should jump back if cell is nonzero Hugely convoluted approach; you want to put the matches in the brackets array so it’s like case ‘[‘: if (arr[ptr] == 0) i = brackets[i]; break; Why i = brackets[j][1] – 1; and not just i = brackets[j][1]; (extra speed cost) Having j and pos laboriously correlate … Read more

[Solved] What is “OpType” in C/C++ programing [closed]

There is no such thing as “OpType” neither in C nor in the C++ language. It is a name that can be declared by the program. If such name is declared by the program, then its meaning depends on that declaration. If such name isn’t declared, then the name cannot be used. If you attempt … Read more

[Solved] compound interest calculator on the deposit [closed]

You divided an integer by an integer ((1 + interestRate / 12 / 100)): this produces an integer. To get the result you expect, either cast interestRate to an int, or parse it as a double like you did with initialAmount: static double Calculate(string userInput) { var arrString = userInput.Split(‘ ‘); double initialAmount = double.Parse(arrString[0]); … Read more

[Solved] What do these operators do in C [closed]

The key to answering this question is realization of how C treats integers that participate in logical operations: Zero is treated as FALSE All values other than zero are treated as TRUE Here are the truth tables for the three operators from your code snippet: !FALSE -> TRUE !TRUE -> FALSE FALSE || FALSE -> … Read more

[Solved] Different results on using sqrt() and pow() functions

First of all, sqrt(x) should be faster and more accurate than pow(x,0.5), why do you think it’s in the library? Second, you’re probably getting a wrong answer because your loop termination condition is testing a floating-point number. A tiny round-off somewhere in one of those 2 million loops is probably enough to throw off the … Read more

[Solved] execute program while window handled mfc

It sounds like you need a windows hook. http://msdn.microsoft.com/en-us/library/windows/desktop/ms644959(v=vs.85).aspx#whgetmessagehook with WH_GETMESSAGE you get to see the windows events being processed by the other application’s window, you could then wait for the WM_CLOSE to show up, and kill your dialog. solved execute program while window handled mfc

[Solved] How to access vector D[20]?

Well you are declaring an array of 20 vectors. So right way would be D[1].push_back(make_pair(0,make_pair(1,2)); int a = D[1][0].first; pair<int,int> b = D[1][0].second; b.second++; // You now have a pair containing increased value. Original remains unchanged. int z = D[1][0].second.second; // contains the nested pair’s second value If you want to increase the second – … Read more