Friday, May 21, 2010

Visual Studio problem......?

Objective: To acquaint the programmer on how to add and use a DLL in a program in Visual


Studio.


The program must be turned in electronically to the TA, and the output of this program must


be printed out and submitted on the day it is due. This assignment also has to compile and


run in Visual Studio in order to receive complete credit for the program.


Make certain that for each function, a prototype is created and placed at the beginning of the


program after the #include statements and before the first function.


The output from this program needs to be captured from the system using the console edit as


demonstrated in class. The *.cpp file that is generated will need to be e-mailed to the grader.


Task 1. Add the PROG3.DLL to your program


Remember, to add the PROG3. DLL, the program must have the Prog3.lib and the Prog3.h


file added to the project, and the Prog3.dll file in the working directory. Using the debug


feature, the working directory is where your *.cpp file is usually kept. If running from a


console, then Prog3.dll needs to be in the same directory as your executable. Call Initialize()


at the beginning of your Main function.


This DLL consists of the following functions that can be called from the DLL once the


programming project has been set up.


Function: void Initialize();


Input Value: None


Return Value: None


Description: Initiailze, when called, sets the minimum range limit to 0, the maximum range limit to 0, and the


bit resolution to 0 inside of the DLL.


Function: void SetMin(float Num);


Input Value: float Num


Return Value: N/A


Description: SetMin, when called, sets the minimum range limit to the value of Num.


Function: void SetMax(float Num);


Input Value: float Num


Return Value: N/A


Description: SetMax, when called, sets the maximum range limit to the value of Num


Function: void SetResolution(int Num);


Input Value: int Num


Return Value: N/A


Description: SetResolution, when called, sets the bit resolution of the binary range to the value of Num.


Function: float GetMin();


Input Value: N/A


Return Value: float


Description: GetMin, when called, returns the floating point number that is equal to the minimum range limit


last set in the DLL.


Function: float GetMax();


Input Value: N/A


Return Value: float


Description: GetMax, when called, returns the floating point number that is equal to the maximum range limit


last set in the DLL.


Function: int GetResolution();


Input Value: N/A


Return Value: int


Description: GetResolution returns the value of the bit resolution currently set within the DLL.


Function: float FindUnitValue(int BinaryValue);


Input Value: int BinaryValue


Return Value: float


Description: FindUnitValue takes the integer provided and applies the Binary Range formula to that integer


and returns the value of that number in units as a floating point number.


Task 2. Create a menu using a switch statement that performs the following tasks using the


DLL.


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


Menu item Set Minimum should prompt the user for input, read in the input, and then call


SetMin and pass the value taken from the keyboard.


Menu item Set Maximum should prompt the user for input, read in the input, and then call


SetMax and pass the value taken from the keyboard.


Menu item Set Resolution should prompt the user for input, read in the input, and then call


SetResolution and pass the value taken from the keyboard.


Menu item Get Minimum should call GetMin and print out the value to the screen.


Menu item Get Maximum should call GetMax and print out the value to the screen.


Menu item Get Resolution should call GetResolution and print out the value to the screen.


Menu item FindUnitValue should prompt the user for an integer, read in the input, and then call


FindUnitValue, and print the result to the screen.


Menu item Initialize should simply call Initialize().


Menu item Quit should exit the program.


Now that strings have been covered, a new method of gathering the data may be used. Scanf may


still be used, but an alternate form of getting the input is below.


It is possible to read a statement from the keyboard as a string, with the fgets command, and then


convert the result into either an integer using atoi or a float by using atof. Be sure to #include


%26lt;stdlib.h%26gt; at the beginning of the program.


Given: char StringVar[80];


For example, to get a single float from the user:


printf("Please enter the new minimum range limit:\n");


fgets(StringVar,80,stdin);


FloatVar=atof(StringVar);


For example, to get a single integer from the user:


printf("Please enter the binary value to convert.\n");


fgets(StringVar,80,stdin);


IntVar=atoi(StringVar);


Sample Output:


Eric Becker


CSE 1311-001 and CSE 1311-002


October 20, 2006


Programming Assignment #3


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


1


Please enter the new minimum range limit:


-10


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


2


Please enter the new maximum range limit:


10


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


3


Please enter the new bit resolution:


16


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


4


The current minimum is -10 units.


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


5


The current maximum is 10 units


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


6


The current resolution is 16 bits.


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


7


Please enter the binary value to convert.


40960


The unit value is 2.500000 units.


1. Set Minimum


2. Set Maximum


3. Set Resolution


4. Get Minimum


5. Get Maximum


6. Get Resolution


7. Find Value


8. Initialize


q. Quit


q


Task 3. Use the program to find the value for the following case.


Case 1: Given a minimum of -5, a maximum of 5, and a binary resolution of


10, what is the value of 768?


Case 2: Given a minimum of -5, and a maximum of 5, and a binary resolution


of 12, what is the value of 1024?


Case 3: Given a minimum of -10, and a maximum of 10, and a binary


resolution of 16, what is the value of 49152?


Case 4: Given a minimum of -57.2958, a maximum of 38.1972, and a


resolution of 14, what is the value of 14746?


Task 4. The output from your program is required to be turned in on the due


date. This output should show the results of Task 5.


Task 5. Submit the electronic version of the code for grading. Send the *.cpp


file of your program to the GTA.

Visual Studio problem......?
Ok
Reply:42
Reply:soooo.... whats the question??? do you think someone is going to develop this for you?? I think NOT!


No comments:

Post a Comment