Program :
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float *grades; // a pointer used to point to an array
int size;
int count = 0; // track the number of grade/student
float grade; // the grade of a student
float average, total; // average grade and total grades
//**************start your code here************************
cout<<"How many student grades do you want to
enter:";
cin>>size;
grades = new float[size];
cout<<"Enter "<<size<<" students
grades"<<endl;
while(count<size)
{
cin>>grades[count];
count++;
}
//**************end your code here************************
for (int i = 0; i < count; i++)
{
cout << "grades for student " << i + 1 << ": is "
<< grades[i] << endl;
}
for (int i = 0; i < count; i++)
{
total = total + grades[i];
}
average = total / count;
cout << "Average grade is $" << average <<
endl;
delete [] grades;
return 0;
}
Screenshot of the program :

Output :

Implement and test a function that uses dynamic array to store students’ grades and calcuate the...
What did I do wrong with this C++ code? Assume that we don't need to ask users for the number of students. #include <iostream> #include <iomanip> using namespace std; int main() { float *grades; // a pointer used to point to an array int size; int count = 0; // track the number of grade/student float grade; // the grade of a student float average, total; // average grade and total grades //**************start your code here************************ cout<<"How many student grades...
/* Array expander: Write a function that accepts an int array as argument. The function should create a new array that is n times the size of the argument array, where n is a user input. The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0. The function should return a pointer to the new array */ #include <iostream> using namespace std; const int NUM_ELEM...
// This program will read in a group of test scores (positive integers from 1 to 100) // from the keyboard and then calculate and output the average score // as well as the highest and lowest score. There will be a maximum of 100 scores. // #include <iostream> using namespace std; float findAverage (const int[], int); // finds average of all grades int findHighest (const int[], int); // finds highest of all grades int findLowest (const int[], int); //...
#include <iostream> using namespace std; int main(void) { int SIZE; cout<<"Enter the size of the array"<<endl; cin>>SIZE; int *numlist = new int[SIZE]; // Read SIZE integers from the keyboard for (int i = 0; i<SIZE; i++ ) { cout << "Enter value #" << i+1 << ": "; cin >> numlist[i]; } // Display the numbers in a reverse order for (int i = SIZE; i > 0; i--...
// 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; //...
Modify Assignment #18 so it drops each student’s lowest score when determining the students’ test score average and Letter grade. No scores less than 0 or greater than 100 should be accepted #include<iostream> #include<string> using namespace std; int main() { double average[5]; string name[5]; char grade[5]; for(int i=0; i<=5; i++) { cout<<"Enter student name: "; cin.ignore(); getline(cin,name[i]); int sum=0; for(int j=0; j<5; j++) { int grades; cout<<"Enter Grades:"<<j+1<<" : "; cin>>grades; sum+=grades; } average[i]=(float)sum/5; if(average[i]>=90 && average[i]<=100) grade[i]='A'; else if(average[i]>=80...
using the code above my instructor just want me to
delete name from a list of students name. the function needs to be
called delete_name. It's in c++. please no changing the code above
just adding. this is pointer and dynamic array.
// This is chapter 9 Pointers and Dynamic array #include< iostream> #include<string> using namespace std; //Gv //function declaration string* add_name(string*,int&); void display_names (string*,int); //main int main() //local var int size-3; string *students_names-new string[size]; //code cout<<"Enter "<<size< students names:"<<endl;...
I Need Help. I MUST USED VECTOR OF STRUCTUERS INSTEAD OF AN ARRAY. HOW CAN MAKE THIS INTO VECTOR STRUCTUERS? #include #include using namespace std; // This program demonstrates how to use an array of structures// PLACE YOUR NAME HERE // Fill in code to define a structure called taxPayer that has three// members: taxRate, income, and taxes -- each of type float int main(){ // Fill in code to declare an array named citizen which holds // 5 taxPayers structures cout...
How to initialize a dynamic two-dimensional array with values? (C++) Here's my problem... # include using namespace std; int main() { // Q#5 - dynamic 2d arrays, indexing via subscript operator, pointer arithmetic // tic tac toe board is an array of int pointers // each int pointer in the board points to a row // declare a pointer to an array of int pointers (i.e. a pointer to a pointer of type int) const...
Question 1: Fix the 2D dynamic array initialization in following code #include <iostream> using namespace std; int main(){ int rows = 5; int cols = 5; int x; int** arr = new int[rows][cols] cin >> x; arr[x][x] = x; cout << "arr[x][x] = " << arr[x][x]; return 0; } Question 2: Fix the code to initialize the 2D array elements to x #include <iostream> using namespace std; int main(){ int rows; int cols; int x;...