[Solved] I can’t run this code of coverting an array into a list

Your definition for the array is incorrect, it should be: int t[n]; Note that you do not need to declare a local array for your purpose, but you should check for proper conversion by scanf. Note also that insert_end probably does not take a list *** argument. Here is an improved version: void tab2list(int n, … Read more

[Solved] how to convert decimal value into int in c# [closed]

As per your requirement, round decimal up to 2 place using following way : 1) Use Math.Round(). var vatprice= Convert.ToDecimal(Math.Round(dt.Rows[0][5], 2)); 2) second way is var vatprice=Convert.ToDecimal(dt.Rows[0][5].ToString (“#.##”)); solved how to convert decimal value into int in c# [closed]

[Solved] I can’t get enum class operators to work

A binary operator member should only take one parameter, the right-hand argument – the left-hand argument is *this. template<int NMAX> typename FastOut<NMAX>::Flags FastOut<NMAX>::operator&(Flags rhs) const { // Return *this & rhs } solved I can’t get enum class operators to work

[Solved] Check if null before set to null?

No, there is not much use. Probably checking the variable being null or not is just as expensive as setting it to null one time too many. If it was a property, with additional logic behind it, it could make sense to test it before, but that should actually be the responsibility of the logic … Read more

[Solved] how to show the progress bar while loading the crystal report

Loading report is a single operation (two at most: query and displaying the viewer), so that you can’t split it do display progress accurately. You could display progressless bar or use animated image like this one: That operation has to run in parallel to UI thread (use Thread, Task or BackgroundWorker), otherwise your progress (progressbar … Read more

[Solved] Getting CS1513 } Expected, but all braces are there [closed]

It doesn’t make any sense to mark local method variables as private. That is what is causing your errors. Why the compiler is giving you an } expected error, I’m not sure. I’m guessing that the compiler is assuming that private int howmanybars is being interpreted as a private instance field definition, which cannot be … Read more

[Solved] how to operate on global variables in c++

The problem is that you’re storing pointers into cstr in argv, but then you’re deleting cstr at the end of the parse() function. Get rid of: delete[] cstr; Also, you should pass argc by reference. Otherwise, when you update it in the parse() function it won’t update the caller’s variable. So it should be: void … Read more

[Solved] Difference between the two?

An operator is a function which can be represented with a special syntax. So the following, if defined on a class MyClass: T MyClass::operator% (int k); can be called as follows: MyClass a; int k = 1; T answer = a % k; The other operator: T MyClass::operator[] (int k); Can be called by: T … Read more

[Solved] C# Lookup ptimisation suggestion are welcome

Neater, more linq: var data = GetData(); foreach (var v0 in data) { if (v0.Key.Item3 != string.Empty) continue; //Get all related data var tr_line = data[v0.Key]; sb.AppendLine(tr_line.First()); var hhLines = from v1 in data where v1.Key.Item2 == string.Empty && v1.Key.Item1 == v0.Key.Item1 select data[v1.Key]; foreach (var hh_line in hhLines) { sb.AppendLine(hh_line.First()); var grouping = v0; … Read more

[Solved] 3D or 2D graphics in c/c++? [closed]

You will have to draw every line and circle through your code,there won’t be a shortcut for that. Though, I would suggest using other graphics libraries like OpenGL. In other languages certain IDEs have features wherein you don’t have to write a code but you can manually design your graphics on a editor window and … Read more

[Solved] Creating a property of Type Dictionary [closed]

The only thing missing is initialization of the property – it is null otherwise (meaning that calling Add on it will throw a NullReferenceException). DatabaseLogger.ILogger logger = new DatabaseLogger.Logger(); logger.customProperties = new Dictionary<string, string>(); logger.customProperties.Add(“companyName”, “Company”); logger.customProperties.Add(“application”, “application”); Though this might be better done in the Logger constructor: public Logger() { customProperties = new Dictionary<string, … Read more

[Solved] Find and replace dynamic values via for loop

I think this is what you want, List<string> keys = new List<string>() { “name”, “age”, “param3” }; string url = “http://www.test.com/test.aspx?testinfo=&|&;”; Regex reg = new Regex(“&”); int count = url.Count(p => p == ‘&’); for (int i = 0; i < count; i++) { if (i >= keys.Count) break; url = reg.Replace(url, keys[i], 1); } … Read more

[Solved] Turing Machine Simulator [closed]

Try something like this: #include <iostream> #include <string.h> #include <vector> #include <fstream> #include <cstdlib> #include <stdio.h> #include “tm.h” using namespace std; tm::tm(char *fn) { current = “”; readFile(fn); } void tm::readFile(char *fn) { char temp; string word = “”; ifstream indata; bool blank = false; indata.open(fn); //opens the file if(!indata) //error message if the file … Read more

[Solved] How can I use the function toupper() in this code? [closed]

You need to toupper every single character, e.g. while( (leido = read(0,&buffer,sizeof buffer)) > 0){ for (int i=0; i<leido; i++) { buffer[i] = toupper((unsigned char)buffer[i]); } retorno = write(1,&buffer,leido); } 2 solved How can I use the function toupper() in this code? [closed]