[Solved] Shuffle character array in C

[ad_1] Having char names[16][20] = …; char randomnames[16][20]; you cannot do randomnames[i] = names[j]; but char names[16][20] = …; char * randomnames[16]; … randomnames[i] = names[j]; or char names[16][20] = …; char randomnames[16][20]; … strcpy(randomnames[i], names[j]); Warning when I see your first version of the question you have to print names rather than randomnames, that … Read more

[Solved] Vigenere Cipher c# with “ñ”

[ad_1] Your code: if (Char.IsLetter(s[i])) { s[i] = (char)(s[i] + key[j] – ‘A’); if (s[i] > ‘Z’) s[i] = (char)(s[i] – ‘Z’ + ‘A’ – 1); } Depends on the fact that the letters from U+0041 to U+005A just happen to match a the letters of the alphabets of some languages, such as English*. (If … Read more

[Solved] Array String null

[ad_1] sizeof(item[0].stringArray) in your code is the size of the string pointer, not the size of the space you set. You can try this. In additon, you should pay attention to the size of your array, otherwise you will always right-click the size of the array, can cause array crossing bounds, causing program errors. [ad_2] … Read more

[Solved] Reason for segmentation fault in this snippet of code [closed]

[ad_1] For logic as far as what I understood, you need to remove some flaws then your logic might work. try this one out : for(i=1;i<=n;i++) { flag=0; c=head; while(c!=b) { if(c->d==b->d) flag++; c=c->next; } if(flag==0 && i==1) { a=(list)malloc(sizeof(node)); a->d=b->d; a->next=NULL; taila=a; } else if(flag==0) { new=(list)malloc(sizeof(node)); new->d=b->d; new->next=NULL; taila->next=new; taila=new; } b=b->next; } … Read more

[Solved] Replacing a certain word in a text file

[ad_1] If you don’t care about memory usage: string fileName = @”C:\Users\Greg\Desktop\Programming Files\story.txt”; File.WriteAllText(fileName, File.ReadAllText(fileName).Replace(“tea”, “cabbage”)); If you have a multi-line file that doesn’t randomly split words at the end of the line, you could modify one line at a time in a more memory-friendly way: // Open a stream for the source file using … Read more

[Solved] Tic-Tac-Toe Game c++ [closed]

[ad_1] a1==b1==c1==’X’ This doesn’t do what you think it does. It compares a1 to the boolean result of b1==c1==’X’, probably giving false. To check whether they are all equal, you need a1==’X’ && b1==’X’ && c1==’X’ [ad_2] solved Tic-Tac-Toe Game c++ [closed]

[Solved] Merging sorted lists – C# [closed]

[ad_1] You want to check if you are at the end of your array. If you are, you want to put the largest number at the last index: static int[] Func(int[] array1, int [] array2) { int[] result = new int [array1.Length + array2.Length]; int first =0; int second = 0; int current = 0; … Read more

[Solved] Update xml node data, how [duplicate]

[ad_1] Try my solution, string xml = @”<categories> <category> <id>1</id> <name>Computer</name> <description>Information tech.</description> <active>False</active> </category> <category> <id>2</id> <name>Cate1</name> <description>MMukh</description> <active>True</active> </category> </categories>”; XDocument xDoc = XDocument.Parse(xml); int id = 1; var items = xDoc.XPathSelectElement(“//category[id=” + id + “]”) .Elements() .ToDictionary(e => e.Name.LocalName, e => (string)e); if (items != null) { // display these fields to … Read more