- Learn to use the Visual Studio 2015 platform.
- Use output formatting and pass by reference in C++.
- In Visual C++, create a new Win32 Console Application project. Save the project in your Desktop. Name the project as Lab-03-ex1.
- Type the following program which converts a given length to feet and inches.
- To debug the program do the following ;
- Right click on the line shown and add a “Breakpoint”
- To run the program click “Start Debugging” or press F5.
- The program will stop running at the line which you have put a “Breakpoint”
- Check the “Autos” window on the bottom of the editor to see the initial values of the three variables length, feet and inches.
- Now, to run the program press “F11” or “Step Into” in the “Debug” menu. The program will be executed line by line.
- 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 )
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