IT1050 Lab 3 Solved

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

Objectives:

  • Learn to use the Visual Studio 2015 platform.
  • Use output formatting and pass by reference in C++.

 

Exercise 1:

  1. In Visual C++, create a new Win32 Console Application project. Save the project in your Desktop.  Name the project as Lab-03-ex1.
  2. Type the following program which converts a given length to feet and inches.

Figure 1

  1. To debug the program do the following ;
    1. Right click on the line shown and add a “Breakpoint”

 

Figure 2

 

 

 

Figure 3

 

  1. To run the program click “Start Debugging” or press F5.
  2. The program will stop running at the line which you have put a “Breakpoint”
  3. Check the “Autos” window on the bottom of the editor to see the initial values of the three variables length, feet and inches.
  4. Now, to run the program press “F11” or “Step Into” in the “Debug” menu. The program will be executed line by line.
  5. View how the values of the values in the variables “feet” and “Length” get modified through the reference parameters “t_feet” and “t_inches” in the “convertToFeetAndInches()” function. ( See figure  4 to 8 Below )

 

 

 

 

 

 

Figure 4

 

 

Figure 5

 

 

 

 

Figure 6

 

 

Figure 7

 

 

 

 

 

Figure 8

 

Exercise 2

Write a program to input the marks a student for two assignments and find the final mark of each assignment according to the percentages given.  In your program;

  • Implement a function to find the contribution of each assignment mark sent to the function as parameters. In the function you should update two variables called CA1 and CA2, which are defined in the main program.  The function heading is given below;

void findMarks (int t_marks1, int t_marks2, float &t_CA1, float &t_CA2);

The final CA mark for each assignment is calculated as shown below;

Assignment 1                20%

Assignment 2                30%

  • In the main program, input marks for 5 students and show the percentages of the marks using findMarks() function in a table as shown below. Format the output to 2 decimal places.

 

Student            Marks1             Marks2             CA_1                CA_2

  • 60             65                    00                19.50
  • 37             43                      40                12.90
  • 75             80                    00                24.00
  • 92             75                    40                22.50
  • 53             45                    60                15.90
  • Lab-03-pwnmac.zip