Netwrkengeer
IS-IT--Management
I'm new to programming, and trying to leanr it on my own, and I'm a little confused with syntax and how it differs between functions, variables, etc., and also how to interpret how to use a function from white papers, like MSVC++ on MSDN you can lookup and add functions to your programs by Downloading a Header file, and MSDN will give you a the syntax to use, I don't know how to use it.
So what I'd like to do is put 2 pieces of code below, the first one is code from a book I'm reading and the second one is a function from MSDN. If it is not too much trouble can you comment the first code at each line and tell me why each line is important and what it does.
And the second part, could you show me how to read the syntax and give me a sample code to use the command in. I hope this is not too much work.
Thanks
A. This is supposed to be a simple multiplication program, I will put in line numbers
1. #include <iostream.h>
2. #include <conio.h>
3. #pragma hdrstop
4.
5. int multiply(int, int);
6. void showResult(int);
7.
8. int main(int argc, char **argv)
9. {
10. int x, y, results;
11. cout << end1 << "Enter the first value: ";
12. cin >> x;
13. cout << "Enter second value: ";
14. cin >> y;
15. result = multiply(x, y);
16. showresult(result);
17. cout << end1 << end1 << "Press any key to continue...";
18. getch();
19. return 0;
20. }
21.
22. int multiply(int x, int y)
23. {
24. return x * y;
25. }
26.
27. void showresults(int res)
28. {
29. cout << "The result is: " << res <<end1;
30. }
B. This is directly of of the Microsoft website. I don't get how you use it. but I do have the NPPTypes.h file.
The NETWORKINFO structure describes a NIC.
typedef struct _NETWORKINFO { BYTE PermanentAddr[6]; BYTE CurrentAddr[6]; ADDRESS OtherAddress; DWORD LinkSpeed; DWORD MacType; DWORD MaxFrameSize; DWORD Flags; DWORD TimestampScaleFactor; BYTE NodeName[32]; BOOL PModeSupported; BYTE Comment[ADAPTER_COMMENT_LENGTH];
} NETWORKINFO, *LPNETWORKINFO;
Members
PermanentAddr
Permanent MAC address.
CurrentAddr
Current MAC address.
OtherAddress
Other address that support this (for example, IP, IPX).
LinkSpeed
Link speed, measured in Mbps.
MacType
Media type.
MaxFrameSize
Maximum frame size allowed.
Flags
Informational flags.
TimestampScaleFactor
For example, a value of 1 indicates 1/1 ms, 10 indicates 1/10 ms, 100 indicates 1/100 ms, and so on.
NodeName
Name of remote workstation.
PModeSupported
NIC P-mode support indicator.
Comment
Adapter comment field.
Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 and later.
Header: Declared in NPPTypes.h.
So what I'd like to do is put 2 pieces of code below, the first one is code from a book I'm reading and the second one is a function from MSDN. If it is not too much trouble can you comment the first code at each line and tell me why each line is important and what it does.
And the second part, could you show me how to read the syntax and give me a sample code to use the command in. I hope this is not too much work.
Thanks
A. This is supposed to be a simple multiplication program, I will put in line numbers
1. #include <iostream.h>
2. #include <conio.h>
3. #pragma hdrstop
4.
5. int multiply(int, int);
6. void showResult(int);
7.
8. int main(int argc, char **argv)
9. {
10. int x, y, results;
11. cout << end1 << "Enter the first value: ";
12. cin >> x;
13. cout << "Enter second value: ";
14. cin >> y;
15. result = multiply(x, y);
16. showresult(result);
17. cout << end1 << end1 << "Press any key to continue...";
18. getch();
19. return 0;
20. }
21.
22. int multiply(int x, int y)
23. {
24. return x * y;
25. }
26.
27. void showresults(int res)
28. {
29. cout << "The result is: " << res <<end1;
30. }
B. This is directly of of the Microsoft website. I don't get how you use it. but I do have the NPPTypes.h file.
The NETWORKINFO structure describes a NIC.
typedef struct _NETWORKINFO { BYTE PermanentAddr[6]; BYTE CurrentAddr[6]; ADDRESS OtherAddress; DWORD LinkSpeed; DWORD MacType; DWORD MaxFrameSize; DWORD Flags; DWORD TimestampScaleFactor; BYTE NodeName[32]; BOOL PModeSupported; BYTE Comment[ADAPTER_COMMENT_LENGTH];
} NETWORKINFO, *LPNETWORKINFO;
Members
PermanentAddr
Permanent MAC address.
CurrentAddr
Current MAC address.
OtherAddress
Other address that support this (for example, IP, IPX).
LinkSpeed
Link speed, measured in Mbps.
MacType
Media type.
MaxFrameSize
Maximum frame size allowed.
Flags
Informational flags.
TimestampScaleFactor
For example, a value of 1 indicates 1/1 ms, 10 indicates 1/10 ms, 100 indicates 1/100 ms, and so on.
NodeName
Name of remote workstation.
PModeSupported
NIC P-mode support indicator.
Comment
Adapter comment field.
Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 and later.
Header: Declared in NPPTypes.h.