|
Maybe Google Translate tried to solve it and encountered a divide by zero error.
|
|
|
|
|
I think you are a bit harsh! We all had to learn! Maybe Codeproject should start a Beginners Page
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: I think you are a bit harsh! We all had to learn!
Indeed we did, and for many of us there was no internet to help.
But there seems to be an attitude among a number of students (I assume a minority) these days that they do not have to put any actual effort into learning. We get regular questions in QA of this type, which at best are, "please do my assignment". Some of them even use the excuse that they don't have time to learn, or it must be ready by tomorrow at the latest.
|
|
|
|
|
The question is:
Do you seriously want to learn how to become an IT specialist, who can code, or are you more interested in the party type student life.
The problems you want resolved are quite trivial, and I could easily write you the required lines.
However, I will not! You seem to be early in your course. I have no doubt that your college provided you with the resources required where you can find out how to write this code. Read it, and Try it out, fail and Learn. Writing Code is about Trying and Learning, the whole time. You write the Code, Compile it. You get Compiling errors. That means that the Compiler does not understood what you wrote. Solve them, it Compiles. Now you have a running program or App. Does the App do what you want it to do! Very Often it does not. They call that Debugging!
I learned C and CPP/MFC the hard way. By myself, trial and error. My University simply did not have a computer that students could work with in 1974. My first computer was a Commodore 64 in 1985, where I learned the beginnings of Machine Code and ASM programming. A small PC with a C Compiler came as a godsend, and at the time I was in no doubt what compilers linkers, and debug/retail versions did and could do.
You have an institution with resources behind you. Use those resourses and learn. Stop asking this forum to resolve your exam questions.
Believe it or not,
Everybody on this forum has met intractable issues, All of us have been students, one way or the other. We deal with real science here. Helping you to spoof your exam is never a way forward.
Bram van Kampen
|
|
|
|
|
Given following definition for singly linked list node and a pointer type:
struct Node {
int num;
Node* next;
Node() = delete;
Node(int num) : num{ num }, next{ nullptr } {}
};
typedef Node* NodePtr;
Use following prototype:
void quiz2(NodePtr& head1, NodePtr& target, NodePtr& head2)
to design a function that:
Takes in two linked lists, indicated by head1 and head2, and a NodePtr target
Searches target Node in linked list 1 (by comparing address, not by value):
If found, then connect the whole linked list 2 to the target node. In other words, use list 2 to replace nodes after target. Also update head2 to nullptr as the merged linked list should have only one entry point at head1.
If not found, then connect list 2 to the end of list 1, and set head2 to nullptr for the same above reason.
For example,
list 1: 10->20->30->40, target is the address of node 20, list 2: 11->12->13, then after calling the function, list 1 should be 10->20->11->12->13.
list 1: 10->20->30->40, target is an address that cannot be found in list 1, list 2: 11->12->13, then after calling the function, list 1 should be 10->20->30->40->11->12->13.
When merging, please take care of memory and do not let leak happen. You will be deducted by 10 points if memory leak happens. (Hint: in the first example, what should happen to nodes 30 and 40?)
Submit one .cpp file as your answer to Quiz 2.
Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course.
Attach FileNo file chosen
modified 3-Nov-21 21:01pm.
|
|
|
|
|
Quote: Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course. What part of that statement did you not understand?
|
|
|
|
|
wrote: Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course.
LOL.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
The question is:
Do you seriously want to learn how to become an IT specialist, who can code, or are you more interested in the party type student life.
The problems you want resolved are quite trivial, and I could easily write you the required lines.
However, I will not! You seem to be early in your course. I have no doubt that your college provided you with the resources required where you can find out how to write this code. Read it, and Try it out, fail and Learn. Writing Code is about Trying and Learning, the whole time. You write the Code, Compile it. You get Compiling errors. That means that the Compiler does not understood what you wrote. Solve them, it Compiles. Now you have a running program or App. Does the App do what you want it to do! Very Often it does not. They call that Debugging!
I learned C and CPP/MFC the hard way. By myself, trial and error. My University simply did not have a computer that students could work with in 1974. My first computer was a Commodore 64 in 1985, where I learned the beginnings of Machine Code and ASM programming. A small PC with a C Compiler came as a godsend, and at the time I was in no doubt what compilers linkers, and debug/retail versions did and could do.
You have an institution with resources behind you. Use those resourses and learn. Stop asking this forum to resolve your exam questions.
Bram van Kampen
|
|
|
|
|
Hi!
I am pretty new to this, but im trying to present when the latest winupdate was done on computer, and only found in powershell to present that, and i tried to run it in C#, but no error and no result.
I understand that im doing wrong, but what is the best way to do this?
private void LastWinUpd()
{
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
PowerShell ps = PowerShell.Create();
ps.Runspace = runspace;
ps.AddCommand("$a = (New - Object - com 'Microsoft.Update.AutoUpdate').Results");
ps.AddCommand("$a.LastInstallationSuccessDate | Get - Date - Format 'yyyy-MM-dd K'");
Collection<PSObject> results = ps.Invoke();
runspace.Close();
StringBuilder stringBuilder = new StringBuilder();
foreach (PSObject obj in results)
{
text_LastWinUpd.Text = obj.ToString();
}
}
|
|
|
|
|
Quote: I understand that im doing wrong Yes, this forum is for C/C++ questions.
What happens when you run the powershell commands in PowerShell and not via C#?
|
|
|
|
|
As the other Richard said, you've posted this in the wrong forum.
But you don't need to invoke Powershell in order to create and use a COM object. You can do that directly from C#:
Type t = Type.GetTypeFromProgID("Microsoft.Update.AutoUpdate");
dynamic a = Activator.CreateInstance(t);
DateTime lastSuccessfulUpdate = a.Results.LastInstallationSuccessDate;
text_LastWinUpd.Text = lastSuccessfulUpdate.ToString();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi!
Yeah if possible i want it in C# only.
I trid the code but i gives this:
0001-01-01 00:00:00 +00:00
|
|
|
|
|
What do you get when you run the Powershell code in Powershell on the same computer?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
2021-09-20 is the result from PS command
|
|
|
|
|
The Powershell script and the C# code return the same result for me. Are you definitely running them both as the same user on the same computer?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Works for me:
private DateTime GetLastUpdateSuccessDate()
{
Type t = Type.GetTypeFromProgID("Microsoft.Update.AutoUpdate");
dynamic a = Activator.CreateInstance(t);
DateTime lastUpdate = a.Results.LastInstallationSuccessDate;
return lastUpdate;
}
|
|
|
|
|
Hello All,
I am looking for an C code example to capture DISK IO utilization by a process. Please help me out to get the example.
Thanks.
|
|
|
|
|
|
I am looking for an API which gives DISK IO utilization of a process on windows box. Please share any information related to capture IO utilization.
|
|
|
|
|
Did you actually follow the link I gave you?
|
|
|
|
|
So what is wrong with GetProcessIoCounters function?
|
|
|
|
|
Hey everyone,
I'm a beginner in c++ and I'm trying to connect to my garmin watch via bluetooth. The watch is connected on w10, with bluetooth LE explorer i can see the UUID and service ID for the heartrate. I'm looking for a simple way to connect to it from c++ and read the data.
The last 2 days i've been trying even c++ builder, all kinds of libraries but can't connect.
I'm surprised i can't find simple examples online, bluetooth and windows doesn't seem to be quite simple.
Does anyone have an example on this?
|
|
|
|
|
|
So, I've gotten one stop further, I'm using this code: GitHub - urish/win-ble-cpp: Proof of Concept - BLE on Windows (for Web Bluetooth)[^]
I've put in my shortcodes for the service and charachteristic and the code manages to complete them for the right UUID's so I assume it connects!
these are the shortcodes and ID's, next up, how can i read the values from these?
auto characteristicUUID = Bluetooth::BluetoothUuidHelper::FromShortId(0x2A37);
|
|
|
|
|
Sorry, I cannot answer that. Once you have established a connection then the data passed between the stations will depend on the devices being used. Check the technical documents for the watch you are using.
|
|
|
|