[Solved] converting String to Int in C# [closed]

An integer is a single number with no decimal part, e.g., 3, 28, -76, 154, etc. You have a string, “0/5”. “0/5” doesn’t represent a number (especially as you’ve said it’s not a fraction), so it can’t be converted to an integer because it’s not the same kind of data. You’ll need to change the … Read more

[Solved] Referencing to a pointer member in a different class

As the compiler is telling you, this line: Note n = Note(&track.generator); Tries to construct a Note and supply a Generator** to its constructor (since track.generator has type Generator*, &track.generator has type Generator**). However, your Note class constructor accepts a Generator*, not a Generator**. Just do this instead (notice, that copy-initialization is unnecessary here, rather … Read more

[Solved] Using a for loop in C# to calculate the average of a array of 10 numbers [closed]

using System; class Program { static void Main(string[] args) { string[] cijfers = new string[10] { “7”, “8”, “4”, “6”, “5.5”, “7.5”, “2”, “3.3”, “4.9”, “8.9” }; int i = 0; double sum=0; for (i = 0; i < 10; i++) { sum+=double.Parse(cijfers[i]); Console.WriteLine(“The sum is: {0}”,sum); } Console.Write(“The average is: {0}”,sum/10); } } solved … Read more

[Solved] Working with ICollection. Convert to Dictionary

If I understand your question correctly, you want to use that SuperAwesomeNinjaMethod with the indicated signature, and for the second argument, you want to pass an instance of System.Collections.Generic.Dictionary<TKey, TValue>, right? The Dictionary class implements the ICollection interface, hence you can just pass your Dictionary instance. You will get a collection of KeyValuePair<TKey, TValue> solved … Read more

[Solved] how to use async and await on a method that is time comsuming [closed]

To be able to await MyTimeConsumingTask it must be declared to return a Task. public async Task<SimeType> MyTimeConsumingTask() Since you said it does some network IO, you can rewrite it using async NW IO methods and then await it as var MyResult = await MyTimeConsumingTask(MyClassProperty); But in your case the simplest approach seems to be … Read more

[Solved] why is cin/cout slower than scanf/ printf

The speed difference is largely due to the iostream I/O functions maintaining synchronization with the C I/O functions. We can turn this off with a call to std::ios::sync_with_stdio(false); By default standard C++ streams are synchronized to the standard C stream after each input/output operation. Once synchronization is turned off, the C++ standard streams are allowed … Read more

[Solved] C# How to have it read words and output results [closed]

I totally agree with the other answers and comments, but for convenience here is the code public class Program { public static void Main() { Console.WriteLine(“Who is the best?”); var answer = Console.ReadLine(); if (answer.Equals(“tim”)){ Console.WriteLine(“You’re right!”) } else { Console.WriteLine(“Wrong!”) } } } 1 solved C# How to have it read words and output … Read more

[Solved] (Beginner C++) Code not working [closed]

Your logic is confused, you’re trying to do too much at once. Separate out the different things you are trying to do. Like this void generator(){ // set the whole area to “+” for(int rows=0; rows<10; rows++) for(int cols=0; cols<10;cols++) gameArea[rows][cols] = “+”; // set the position of the hero gameArea[x][y] = hero; // print … Read more

[Solved] make some crc check code, loop for multiple file (c++)

I made several changes to your code. I removed guard headers since we use it only in header files. Old-fasioned memset has been replaced by operation on strings. I suspect that you need to pass char* to CCRC32 object hence sSourceFile is still const char*. I compiled code except parts with CCRC32. #include <iostream> #include … Read more

[Solved] asp.net gridview control binding with other controls [closed]

Welcome to Stack Overflow. call the grid binding function on save button. It would cause the grid re binding. provide code for better answers. these links may help: GridView not Rebinding Properly After Postback What rebinding a gridview has to do with edit mode? Remember Even the questions help. solved asp.net gridview control binding with … Read more

[Solved] Shift operator usage in terms of classes

Take a look at the BitCoin documentation. vRecv is an instance of CDataStream which overloads the operator>> to read and unserialize data. Background To understand the expression, precedence and associativity of operators are important. In C++, the >> operator is left-associative, which means you can rewrite your expression (vRecv >> locator) >> hashStop; // Or … Read more