[Solved] Cannot group strings correctly if use IEnumerable.GroupBy in C# [closed]

To really make sure it comes out as you want it, you could do it like that: var val = val1 .GroupBy(f => Path.GetFileNameWithoutExtension(f)) //group by filename .OrderBy(group => group.Key); //here’s the “Sort” foreach (var group in val) { var q = group.OrderByDescending(f => Path.GetExtension(f)); //order the filenames for outputting foreach (var f in q) … Read more

[Solved] Unable to output anything. [closed]

Review your syntax for calling functions: S2 = *studentData(S1); I believe functions are called without the ‘*’: S2 = studentData(S1); There may be more like this in your program. Edit1: Passing by reference, returning pointer to passed reference On further inspection of your program, the function studentData receives a Student variable passed by reference. This … Read more

[Solved] Adding content of file 1 to file 2 in C [closed]

Open results[2] in append mode: FILE *fp2; fp2 = fopen(results[2], “a”); // a is for append Then you can just loop through the first file and dump to the second one.. something like: char line[100] = {0}; while (fgets(line,sizeof(line),fp) != NULL) fputs(line, fp2); EDIT: Here’s a full compiling program that takes the contents of “test.txt” … Read more

[Solved] C# Dynamic IF Else Statment [closed]

I’m going to guess you are asking how to test multiple items in a collection of unknown size. If so: bool isMatch = true; string valueToCompare = “some value”; for( int i = 0; i < allrowcol.Length; i++ ){ if( allrowcol[i] != valueToCompare ){ isMatch = false; break; } } if( isMatch ){ // do … Read more

[Solved] automatically centerizing text c# console [duplicate]

The following will center one or more lines. namespace CenterTextInWindow { internal partial class Program { static void Main(string[] args) { CenterLines(“Hello world”); Console.ReadLine(); } public static void CenterLines(params string[] lines) { int verticalStart = (Console.WindowHeight – lines.Length) / 2; int verticalPosition = verticalStart; foreach (var line in lines) { int horizontalStart = (Console.WindowWidth – … Read more

[Solved] Regex for specific html tag in C# [duplicate]

instead of using a regex using something like an xml parser may be more useful to your situation. Load it up into an xml document and then use something like SelectNodes to get out your data you are looking for http://msdn.microsoft.com/en-us/library/4bektfx9.aspx 2 solved Regex for specific html tag in C# [duplicate]

[Solved] How can i Access a private variable in another class in C#

You make members private so that nobody outside the class can access them. This goes inline with the principle of information hiding. Your example should look like this: public class AccessModifiers { // You can only access this inside of the class AccessModifiers private int Abc { get; set; } internal void SetValue(int x){ // … Read more

[Solved] This code is not working properly and it doesn’t make any sense why it isn’t to me. Does anyone have a guess what the problem might be?

You still do not include all relevant code in your question. It shoes letters have been guessed at the very start of the game, when which, obviously you haven’t guessed any. The problem is at this point of your code: array<bool, 26> guessed; This does not set the elements of the array to false, and … Read more