[Solved] c#: how to check date falls between Dec to Jun? [closed]

DateTime.Today.Month has a return type of int, but you’re checking against a char value type. This check also returns true everytime as every month value is less than 12 or greater than 6 months. Rewrite this to be: int todayMonth = DateTime.Today.Month; if(todayMonth >= 6 && todayMonth <= 12) Edit: To check if the date … Read more

[Solved] Templated polymorphism is not working [closed]

The main issue is you need to inherit template class this way: template<class T> class rectangle : public polygon<T> // polygon is a template, you need to make ^^^ // rectangle from a concrete polygon type 1 solved Templated polymorphism is not working [closed]

[Solved] Speed up Eclipse CDT start up? [closed]

This answer about configuring the ecilpse.ini file can help you: What are the best JVM settings for Eclipse? The configuration I have has increased a bit the overal performance, but at the cost of slightly slower startup -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar –launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 -product org.eclipse.epp.package.jee.product –launcher.defaultAction openFile –launcher.XXMaxPermSize 256M -nosplash –launcher.XXMaxPermSize 256m –launcher.defaultAction openFile -vmargs -server -Dosgi.requiredJavaVersion=1.7 … Read more

[Solved] Scan input from file line by line [closed]

If you’re going to do this with fscanf, you want to use a scan set conversion, like: int a, b; char c[256]; fscanf(infile, “%d %d %[^\n]”, &a, &b, c); To scan all the lines in the file, you’d do something like: while (3 == fscanf(infile, “%d %d %[^\n]”, &a, &b, c)) process(a, b, c); fscanf … Read more

[Solved] Why location 0x00000000 is accessible if it is a flash memory

The decision as to what happens when using what address is rather complex. It depends on the processor architecture, OS and sometimes “what some software does”. The processor may not have memory protection, or address zero may indeed be “used for something” (in x86 real-mode, that DOS runs in, address zero contains the vector table, … Read more

[Solved] How are going to read a text file and auto save in c # [closed]

read all text string fileText = File.ReadAllText(“filePath”); if (fileText.Contains(“apple”)) { Messagebox.Show(“This word is exist”); } else { Messagebox.Show(“The word does not exist!”); File.AppendAllText(@”filePAth”, “The word does not exixt in the text file” + Environment.NewLine); } 1 solved How are going to read a text file and auto save in c # [closed]

[Solved] strncmp don’t work as it should

strcmp & strncmp functions return 0 if strings are equal. You should do: if (strncmp(frase1, frase3, 4) == 0) … i.e.: char *str1 = “Example 1”; char *str2 = “Example 2”; char *str3 = “Some string”; char *str4 = “Example 1”; if (strncmp(str1, str2, 7) == 0) printf(“YES\n”); // “Example” <-> “Example” else printf(“NO\n”); if … Read more

[Solved] C Program for reading test results [closed]

When using if statements and you want to compare a result you should use == instead of =. With = you are assigning a value to a variable and == compares between to values. You can also not compare two things at the same time like: if (result = 70<=100) You need to check if … Read more

[Solved] Make table for pi using C coding language [closed]

Width and precision specifiers can be replaced by an *, that makes printf look for the value in the arguments. printf(“%5.3f”, M_PI); is equivalent to printf(“%*.*f”, 5, 3, M_PI); but now 5 and 3 can be replaced with expressions calculated at runtime. The rest of your exercise should be trivial. 1 solved Make table for … Read more