[Solved] How to adress variable by name stored in another variable (C++)

[ad_1] Variable names disappear as part of the compilation step(s) in C and C++. Typically, there are two scenarios that solve the type of problem you are describing: User input corresponds to specific variable name. You don’t actually want the “name” of the variable, but just need a way to associate different data with different … Read more

[Solved] Vector Subscript Out of Range C++ [closed]

[ad_1] The problem is that in the DeckOfCards class, the deck vector is never added to, so it’s empty. In the constructor, assign newDeck to deck: deck = newDeck; There is also another problem in the constructor: You declare newDeck to contain 52 entries, but then you use push_back to add new entries to the … Read more

[Solved] C programming code error

[ad_1] These: scanf(“%i”, y[i][j]); scanf(“%i”, d[i]); needs to be: scanf(“%i”, &y[i][j]); scanf(“%i”, &d[i]); as %i in the scanf expects an int*(address of the variable), not an int(value of the variable). Another problem is that you do division by zero here: inv[i][j] = co[i][j] / D; when D is zero. [ad_2] solved C programming code error

[Solved] C++ , variables , abstract/ virtual class

[ad_1] A few things. First name your functions sensible things, those names are gibberish and mean nothing to anyone on here. Second, you’re error is quite simple. The “Wolf” and “Animal” class do not need to re-declare “inicjatywa,” so long as they declare their inheritance of “Organizmy” to be public (as they have) the ‘outside … Read more

[Solved] Save Current Date into 3 Ints – C++ [closed]

[ad_1] #include <ctime> int main() { time_t t = time(0); // current time: http://cplusplus.com/reference/clibrary/ctime/time/ struct tm * now = localtime(&t); // http://cplusplus.com/reference/clibrary/ctime/localtime/ // struct tm: http://cplusplus.com/reference/clibrary/ctime/tm/ int day = now->tm_mday; int month = now->tm_mon + 1; int year = now->tm_year + 1900; } Links from above time(0): current time: http://cplusplus.com/reference/clibrary/ctime/time/ localtime: http://cplusplus.com/reference/clibrary/ctime/localtime/ struct tm: http://cplusplus.com/reference/clibrary/ctime/tm/ … Read more

[Solved] How to limit signed int with AND operator in C?

[ad_1] It is unclear what you want to achieve. Masking the low bits while keeping the sign bit is something you could do with a single mask on architectures where int is represented as sign / magnitude. It is quite unlikely that you would be thinking of this peculiar case. What is your goal then … Read more

[Solved] Use List of custom Business Objects as ComboBox datasource

[ad_1] public class MyClass { public string FirstProperty { get; set; } public int SecondProperty { get; set; } } Then: var myList = new List<MyClass> { new MyClass {SecondProperty = 1, FirstProperty = “ABC”}, new MyClass {SecondProperty = 2, FirstProperty = “ZXC”} }; comboBox1.DataSource = myList; comboBox1.ValueMember = “FirstProperty”; comboBox1.DisplayMember = “SecondProperty”; I hope … Read more

[Solved] Chips and Salsa using header file

[ad_1] There are many issues with your code. The following code may do what you want. You should study it and try to improve it. One such improvement could be the use of std::vector as opposed to arrays. This will mean you can avoid manual memory management (new/delete) and therefore achieve the ideal of not … Read more