[Solved] C++ Check if number is even or odd

[ad_1] #include “stdafx.h” #include <iostream> using namespace std; int main() { system(“color f0”); int n = 0, A[1337]; cout << “Enter number of array members: ” << endl; cin >> n; //Make sure n is not bigger than your arrays if( n > 1337 ) n=1337; cout << “Enter numbers : \n”; for (int i … Read more

[Solved] How to insert a single row data in a excel in c#?

[ad_1] Indeed, this question already exists in stack overflow. By the way you can try this simple solution. public void loggeneration(DateTime datetime, string projectname, int totallines, int sum, int max) { // this is the variable to your xls file string path = @”c:\temp\log.xls”; // This text is added only once to the file. if … Read more

[Solved] Why does my if else in this code doesn’t work? are we can not put if else inside another looping or is just my laptop that doesn’t work? [closed]

[ad_1] Why does my if else in this code doesn’t work? are we can not put if else inside another looping or is just my laptop that doesn’t work? [closed] [ad_2] solved Why does my if else in this code doesn’t work? are we can not put if else inside another looping or is just … Read more

[Solved] in the c++ hacker rank preperation cause, the last index returns 0 when i reverse it. but when i try the code out in visual studio, it works perfectly [closed]

[ad_1] As mentioned in the comments, array should be initialized with a proper capacity. You should first read the size and then create the array. #include <iostream> using namespace std; int main() { int n; // First read the array size and then create the array. cin>>n; //inputting the array size int array[n]; //inputting the … Read more

[Solved] Find if two lines in 3D are collinear [closed]

[ad_1] Two lines are collinear if scalar multiplication of two vectors equals absolute value of a multiplication their length (it works in 3D). Simply write a method that calculate scalar multiplication private double scalarMultiply(Vector L1, Vector L2) { return L1.X()*L2.X() + L1.Y()*L2.Y() + L1.Z()*L2.Z(); } and length of vectors vectorMod = System.Math.Sqrt(x * x + … Read more

[Solved] How do I build a function in C# that returns a delimited set of string numbers? [closed]

[ad_1] This is example in the purest, basic, sugar-less form public string GetDelimited(int numberOfLoops, string delimiter) { var builder = new StringBuilder(); for (int i= 1; i < numberOfLoops + 1; i++) { if (i > 1) builder.Append(delimiter); builder.Append(i.ToString()); } return builder.ToString(); } 0 [ad_2] solved How do I build a function in C# that … Read more

[Solved] which sentence is largest and how many number contains [closed]

[ad_1] You were close to getting there. This is easiest if you use the System.Linq namespace: string[] txt = i.Split(new char[] { ‘.’, ‘?’, ‘!’, ‘,’ }); //this part you had correct var stringsOrderedByLargest = txt.OrderByDescending(s => s.length); stringsorderedByLargest will now contain be sorted from longest to shortest. If you want to count how many … Read more

[Solved] how to split and join files in c or rust? [closed]

[ad_1] In C++, you split files by reading the master and writing to one or more new files. This technique works with the C language also. Joining files depends if you want to merge or append. In the append case, the destination file is opened with the “append” and write attribute. The file pointer is … Read more

[Solved] Use of * and &? [closed]

[ad_1] Try looking at * not as being in front of function name, but rather as being behind TreeNode. In other words, that * changes function return type from structure to pointer to a structure. & in front of variables means that they are, essentially, still pointers, but they can’t be NULL (there are ways … Read more

[Solved] Do-while acting funny in my basic singly linked list implementation in C. Please identify the error [closed]

[ad_1] When you enter anything for input with Scanf, you end it with a newline. The problem is that the scanf function only extracts the input requested, and leaves the newline in the input buffer, so in the next iteration the program reads and extracts that newline and sees it as invalid input and loops … Read more