Question
Q # 1 In this exercise you will create a small function which adds two decimal numbers and sets result in third argument. Function signature
Q # 1
In this exercise you will create a small function which adds two decimal numbers and sets result in third argument. Function signature is: AddNumbers (int firstValue, int secondValue, int* result); 1. In main function read values from user for both arguments to add 2. Call AddNumbers method by passing both arguments to add and a pointer of type integer to receive result 3. Inside AddNumbers function, add both numbers and set result in pointer argument 4. After exiting AddNumbers function, display value of result variable .
Q # 2
In this exercise you are required to make use of pointer as function arguments. 1. Create a function PrintStudent which accepts pointer to student type 2. Create and initialize an instance of student class and fill in data in main method 3. Pass initialized student object to PrintStudent method 4. Display data inside PrintStudent function.
Q # 3
In this exercise you will create array of objects and perform search in the array based on user provided values. To accomplish the task: 1. Create an array of student class which can store 10 instances 2. Take input / data from user to initialize student instances on run time to fill student array 3. Create a function named FindStudent outside main method (at the level where main is defined) which can accept an array of type student and returns a single instance of student. a. Create a function with two arguments with following signature Student FindStudent ( Student students [ ] , int rollNumber) 4. Inside this function write code to search student in array against provided roll number (remember, array and roll number to find are being provided as arguments) 5. If student is found return found student instance from array 6. Print found student data (use setw e.g. to adjust display) .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started