using c/c++
Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average that
(a)
#include <iostream>
using namespace std;
int i=0;
float avg;
int average(int x, int y);
int main()
{
while(i<=1)
{
cout<<i;
int a,b;
cout << "Enter a integers : " << endl;
cin>>a;
if(i==0)
{
b=a;
}
if(i==1)
{
float ret = average(a,b);
cout << "The average of " << a << " and
"<<b<< " is " << ret<< "." <<
endl;
}
i++;
}
}
int average(int x,int y)
{
int sum;
sum=x+y;
avg=sum/2;
return avg;
}
using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average...
Create a class called Student. This class will hold the first name, last name, and test grades for a student. Use separate files to create the class (.h and .cpp) Private Variables Two strings for the first and last name A float pointer to hold the starting address for an array of grades An integer for the number of grades Constructor This is to be a default constructor It takes as input the first and last name, and the number...
3. Write a program following the requirements below: (20 marks) (a) Write a function named average() that calculates and returns the average value of 3 single-precision floating-point numbers. (b) Include the function in a working program and test the functionality of the function average( ). Make sure your function is called from main() and correctly returns a value to main().
C++ Program Int Main First Please Write one program that does the following: 1. 1. Ask the user for ten (10) grades, and store the data in an array. Compute the average of all the grades. Print the original ten grades and the average. a. Declare an integer array with the name of “grades” of size 10 in the main function. b. Create a function called “getGrades” that prompts the User for the grades and puts them in an integer array. i. The function will receive...
using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...
1. Write code for a function that receives two parameters (a,and b) by value and two more parameters (c and d) by reference. All parameters are double. The function works by assigning c to (a/b) and assigning d to (a*b). The function has no return value. From main, use scanf to get two numbers, then call the function, and then display both outcome values to the output in a printf statement. 2. After part 1 is completed, write code to...
A hard c++ problem ◎Write a c++ program”Student.h”include Private data member, string firstName; string lastName; double GPA(=(4.0*NumberOfAs+3.0*NumberOfBs+2.0*NumberOfCs+1.0*NumberOfDs)/( As+Bs+Cs+Ds+Fs)); Public data member, void setFirstName(string name); string getFirstName() const; void printFirstName() const; void getLastName(string name); string getLastName() const; void printLastName() const; void computeGPA(int NumberOfAs,int NumberOfBs,int NumberOfCs,int NumberOfDs,int NumberOfFs); double getGPA() const; double printGPA() const; A destructor and an explicit default constructor initializing GPA=0.0 and checking if GPA>=0.0 by try{}catch{}. Add member function, bool operator<(const Student); The comparison in this function based on...
a. Write a function named findmax() that finds and displays the maximum values in a two dimensional array of integers. The array should be declared as a 10 row by 20 column array of integers in main() and populated with random numbers between 0 and 100. b. Modify the function written above so that it also displays the row and column numbers of the element with the maximum value. I have this so far, and but it's only finding the...
2. Write a program named lab3 2.app that contains a class named Student to store student information Information that will be relevant to store is first name, last name, id number, GPA, and major (1) Define a member function named set0, which allows you to set all member variables. This function has an empty parameter list, and its return type is void. So, within the function you'll prompt for information. Note: For entering major, if you need a space, use...
Write a program that instantiates an array of integers named scores. Let the size of the array be 10. The program then first invokes randomFill to fill the scores array with random numbers in the range of 0 -100. Once the array is filled with data, methods below are called such that the output resembles the expected output given. The program keeps prompting the user to see if they want to evaluate a new set of random data. Find below...
// PLACE YOUR NAME HERE #include <iostream> using namespace std; float findAverage (int [], int); // finds average of all //grades int findHighest (int [], int); // finds highest of all //grades int findFirstFail( int[]); int main() { int grades[100]; // the array holding 100 grades. int numberOfGrades; // the number of grades read. int pos; // index to the array. float avgOfGrades; // contains the average of the grades. int highestGrade; // contains the highest grade. int inderOfFail; //...