[Solved] How to write a function named isMeera that returns 1 if its array argument is a Meera array. Otherwise, it returns 0 [closed]

Finally it works successfully ! public static int isMeera(int [] a){ boolean hasOdd = false; int firstEven = 0; int lastEven = 0; boolean firstCountEnd = false; boolean lastCountEnd = false; for(int i = 0; i<a.length; i++){ if (a[i]%2 == 1) { hasOdd = true; break; } } if (!hasOdd) return 0; for (int j … Read more

[Solved] joining of two list in C# [closed]

If the indexes of the two lists are the same, then you can do: static void Main(string[] args) { List<string> Mksnos = new List<string>() { “Toyota”, “Honda is Good”, “Innova is very good” }; List<string> GdsDscr = new List<string>() { “Toyota is a very good brand and it is costly”, “The carmaker’s flagship sedan is … Read more

[Solved] C# Console Create simple app not longer than 2 lines

One way to do is use a ternary operator inside another ternary operator. It does the job in two lines. var input = Console.ReadLine(); Console.WriteLine((input == “1”) ? (“2”) : (input == “2” ? “1” : “Enter 1 or 2”)); 2 solved C# Console Create simple app not longer than 2 lines

[Solved] Tic-Tac-Toe game weird symbol

Those ‘weird symbols’ are unicode characters. After declaring your board, the char values are just random symbols, what else should the board elements contain? You have to initialize your board like this: Either on declaration: char board[3][3] = { {‘ ‘,’ ‘,’ ‘}, {‘ ‘,’ ‘,’ ‘}, {‘ ‘,’ ‘,’ ‘} }; Or in the … Read more

[Solved] C# Inheritance Issue – Does not contain a constructor that takes 0 arguments

Taking what you have and Generating a class from VS2010 internal class PhoneNumber { private string a; private string m; private string l; public PhoneNumber(string a, string m, string l) { // TODO: Complete member initialization this.a = a; this.m = m; this.l = l; } } class BlockedNumber : PhoneNumber { public BlockedNumber(string a, … Read more

[Solved] Writing to txt file reach out of memory ? C# [closed]

According to new question, here is the answer: StreamWriter outputFileTwoo = new StreamWriter(resultatsTwoo); List <string> firstListThatIcantRevealItName= new List<string>(); List <string> secondListThatIcantRevealItName= new List<string>(); firstListThatIcantRevealItName=System.IO.File.ReadAllLines(@”C:\Users\me\Desktop\blabla.txt”).ToList(); secondListThatIcantRevealItName=System.IO.File.ReadAllLines(@”C:\Users\me\Desktop\potto.txt”).ToList(); using(StreamWriter outputFileOne = new StreamWriter(resultatsOne)) { foreach (string trade in secondListThatIcantRevealItName) { endofFile++; if (!secondListThatIcantRevealItName.Contains(trade)) { outputFileOne.WriteLine(“Trade number : ” + trade + ” exist in first list but not … Read more

[Solved] Are variables real things? [closed]

Variables are concepts in the C++ abstract machine that may or may not have a concrete counterpart in your computer. The not-so-closely guarded secret is that C++ abstract machines are not easy to come by (they’re abstract!), so instead we use some very smart tools, the compilers, to emulate the behaviour of a C++ abstract … Read more

[Solved] How to self register class instances using the CRTP?

I decided to reopen the question and self answer based on Yakk’s fixes. Seems to be a more common problem (see here for example) Yakk’s example solved it: #include <cstdint> enum class CommandId : uint16_t { Command1 , Command2 , }; #include <map> #include <functional> #include <string> //#include “CommandId.h” class Registry { public: static std::map<CommandId,std::function<void … Read more

[Solved] Sorting Array in c# [closed]

string[] iniArray = { “M Facci”, “D Thornton”, “B Luke”, “S Tofani”, “T Luke” }; var sortedArray = iniArray.OrderBy(r => r.Split(‘ ‘).Last()).ToArray(); or (courtesy @killercam) var sortedArray = iniArray.OrderBy(r => r.Split().Last()).ToArray(); Assuming there is only First Name and Last Name in a string, also, there exists a Last Name. To display the resulted array: foreach … Read more