[Solved] How to debug my C++ program that calculates CGPA?

You have some problems in your code: What happens if user input is larger then 10? you assume it will be smaller (you will get undefined behavior since the array size is 10, and your for loop runs until user input) int g,h,i,a=0, grade[g],hour[h]; – what is the size of grade and hour? you can … Read more

[Solved] Write a program in C# which uses Iterative Binary Search algorithm to search age of the person using his / her name

I do disagree with the way you store your input but you can achieve your search with the following: String[,] arr = new string[2,4]; arr[0, 0] = “saif”; arr[0, 1] = “25”; arr[0, 2] = “ali”; arr[0, 3] = “17”; arr[1, 0] = “aakif”; arr[1, 1] = “11”; arr[1, 2] = “hassnain”; arr[1, 3] = … Read more

[Solved] Replacing a word in a txt using c# in visual studios

the complete version private void button1_Click (object sender, EventArgs e) System.IO.StreamReader sr = new System.IO.StreamReader(openFileDialog1.FileName); private void button2_Click (object sender, EventArgs e) String find textbox1.Text string replace = “dog”; File.writeAllText(openFileDialog1.FileName,File.ReadAllText(openFileDialog1.FileName).Replace(find, replace)); also need to add a textbox solved Replacing a word in a txt using c# in visual studios

[Solved] Why Debug.Writeline is printing my message in reverse [closed]

The format of this function is WriteLine(string message,string category). This means that it will show your category and then, your message. For instance, category could be TRACE or DEBUG. I think that what you are looking for is string.Format. You should have Debug.WriteLine(String.Format(“RefKey value was {0}”, refKey)) solved Why Debug.Writeline is printing my message in … Read more

[Solved] How to get out of this cycle?

Well, there’s always the break command. You can flag that after a key has been pushed, you want to break. And then outside the switch, you break. However, why do you need to have a while(true) loop anyway? solved How to get out of this cycle?

[Solved] How to create a file containing struct [closed]

Your problem “I am guessing” is the structure defintion typedef struct test { int a; }; This is not just a structure definition, but a type definition and it’s missing the type name, it can be fixed like this typedef struct test { int a; } MyTestStruct; or simply remove the typedef and just use … Read more

[Solved] Why there are “null” in c#? [closed]

The problem why you sometimes get null is the concurrent access to your list with the operations Add and ElementAt. Since in your case ElementAt won’t have to enumerate the list it will just check internally if the list is null and in the case it isn’t it will return the element at the specified … Read more

[Solved] Please explain the output of this program based on pointers and strings?

Explanation line by line: Striker=Track; Sets Striker to point to the memory of Track, so Striker[0] would be equals to Track[0]. Track[1]+=30; Increases the value of the second index of Track by 30 (Track[1] = 50). cout<<“Striker >”<<*Striker<<endl; *Striker is the same as Striker[0], *Stirker+1 is the same as Striker[1] and so on. The output … Read more

[Solved] find numbers at string line c++

As mentioned in @Jhonny Mopp’s comment the primary problem is, that you don’t read a whole line here: cin>>line; it just reads up to the next whitespace delimiter. What you actually want is: getline(cin, line); This would read in the whole input until you hit Enter. Regarding the rest of processing refer to that Q&A … Read more

[Solved] What output of the both program is different?

The first one won’t have any output since the stdout stream wasn’t flushed by a newline (or a manual call). In Java, the method called is println, so it’s adding a newline at the end of the string, causing the stream to flush. solved What output of the both program is different?